Dev:APImessage

Aus YaCyWiki
Wechseln zu: Navigation, Suche

Message Transmission

YaCy peer owner may send text messages to other peers. This servlet is used to send such messages.

Operations performed when the servlet is called

The index transmission process is a two-step process. In the first step the sending peer asks for a permission to send a message, the requested peer then tells the requesting peer if this is wanted and how large the message may be and in the second step the sending peer transmits the message through the same servlet.

Servlet Address

The servlet path is /yacy/message.html. The full URL is http://<peer-IP>:<peer-port><servlet-path>.

Properties in the http header

The caller must obey the http header rules.

Properties in the http post-arguments

Calls to the servlet can be made using a GET or POST operation. The properties are:

  • process='permission'|post either the peer asks for permission or it sends the message. If the peer asks for permission, no other properties shall be given.
  • myseed=<the SimpleCoding of the own Peer Seed> the sending peer MUST attach its own seed info to prove that the message is actually send from a YaCy peer and to enable the receiving peer to show who send that message
  • subject=<subject> the message subject line in SimpleCoding
  • message=<message> the fulltext of the message in SimpleCoding

Result

The returned document contains a list of property lines. These properties are:

  • version=<version info>
  • uptime=<uptime of the peer>
  • messagesize=<the acceptable message size in bytes>
  • attachmentsize=<the acceptable attachment size in bytes>
  • response=<a response message> The response message is a plain text, not a response code.

Example Usage

The first step is the retrieval of a permission, which can be done with

http://localhost:8090/yacy/message.html?process=permission

The second step is the transmission of the message. This is not easily done 'by hand', because it requires to create a seed info for a seed that is already known by the receiving peer. It could look like

http://localhost:8090/yacy/message.html?process=post&myseed=p%7C{Hash=sCJ6Tq8T0N9x,Port=8090,PeerType=junior}&subject=p%7CTest&message=p%7CHelloWorld

but you must compute the seed yourself.