Dev:APIhello

Aus YaCyWiki
Wechseln zu: Navigation, Suche

The 'Hello' Peer-Ping Process

/yacy/hello.html is a servlet which returns a property list as result, not a html page as the name would suggest. The purpose of this servlet is a handshake between two peers wich ensure doing this that they are alive and by the way transport some critical information about their network position and the status of their operation together with some 'news', which is (from both sides) a list of recently known or new peers in the network. Every peer is doing one peer-ping each minute by calling the 'hello.html'-servlet of one of the peers in the known list of peers.

Operations performed when the servlet is called

When a peer is pinged by calling the hello.html servlet the ping'ed peer tries to ping the ping-ing peer back by calling the ping-ing peers /yacy/query.html servlet. If the ping'ed peer gets a respond from the ping-ing peer, it assigns the ping-ing peer the senior status, otherwise the status is junior. After the ping-ing peer gets a result, it assigns itself the status as reported by the ping process. If the peer gets no answer at all (i.e. a timeout happens), the peer assigns itself the virgin status.

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:

Result

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

  • version=<YaCy version number of responding peer>
  • uptime=
  • <code>yourip=<the IP of the requesting peer as seen in http request></code>
  • <code>yourtype=<the YaCy peer type as discovered after a back-ping></code>
  • <code>mytime=<the local time of the responding peer in format yyyyMMddHHmmss></code>
  • <code>message=<a status message, can contain error status></code>
  • <code>seed<c>=<a SimpleCoding of other peer Peer Seeds in the network></code>; this is a list of seed0 .. seed<count> properties where 0 <= <c> <= <count>. There will be always count+1 seeds returned since the seed0-property contains always the seed of the called peer.

Example Usage

An example URL is

http://localhost:8090/yacy/hello.html?count=1&seed=p%7C{Hash=sCJ6Tq8T0N9x,Port=8090,PeerType=junior}

which may return something like this:

version=0.1
uptime=16
yourip=127.0.0.1
yourtype=junior
mytime=20131128235655
message=ok 47
seed0=z|H4sIAAAAAAAAADWPQU-DQBCF_woXPeiE7M7CAjFzkcaUpDGkgHeUUVG7kN2tpjH-d7elncsk8zLfe-_3ia0bJ0MilmIZeCynvfEkoJv9uGOSKZTLKc3icG1m5iHIm975htkQCqmkxBxVqlUOrqO00NAsPzLVUNWU6BhlXBQxaticFVkgVBfa9uLqKlJBWPfunfAzM8qun4dV-wr1ZD3lohBQM9v2MDN97M04Wejakm6FPGbvQ-CBvz07D9WCVEIG07Z_c3QDtqIsS8B2p7U9u4daVX0iXvNu9oc7MPzjCO5XvedTP4GYIIZ-CMNLyK40JnmeYaq0gIevI_wqiqK_f31a9vFRAQAA
seed1=z|H4sIAAAAAAAAAD3QUUvDQAwH8K_ikw8aSnK3y3pIXpyIBzLK1s7nomEruLbcVWSI392bq-YpEPLLn3ztNKZu6IUKdojeMMF6NXz0kyCs5qZAaMapO6qUbCw8t2naqvZikCyRKY11TB6a7aj6lvdSI9YSooHtRaAFQ6jydkHWFYZMQS4785CXyAsHm7-z4d8JsiCX5ac2HaRsx8PxJXitOUI1xElK9AiVaqxPo0rSvhsiNPVKbjEXrNuc-PWgMZ7Gbg_h4hsi6xnqdp_kBmIQi94ZthCbcxS2-V6ofsVrPY7T6Q42c6AC0ZbsPNMSev1MAvcP7aSXP2CGnSnRweP72b7K9f0DoHbAJ18BAAA