A project log for HTTaP

Test Access Port over HTTP

Yann Guidon / YGDESYann Guidon / YGDES 04/26/2020 at 21:180 Comments

With the latest revision of the server, I have added one more word to the baseline vocabulary for explicit keepalive. As you might have guessed, the word is simply ping.

As an exception, ping is explicitly "free form" and can be followed by just about anything, because it helps to keep the browser and all intermediaries from caching the result, in case the headers are misinterpreted. Thus you can request:


The trailing characters are simply discarded.

The root object should also contain the server's keepalive time/value to help the user script manage its time...


I forgot to specify it in the first draft (that's why this documentation is not definitive).

Early implementations simply reply this:

HTTP/1.1 200 OK
Content-Type: text/plain
Cache-Control: no-cache
Content-Length: 4

However ?ping is meant to help keep the link alive and the reply has an opportunity to be more useful.

This is possible by sending back the number of seconds before the connection is closed. Thus the client can adjust its ping rate and timers to reduce the processor&network use. This is explained in the log 9. Keepalive algorithm. The new type of packet looks like this :

HTTP/1.1 200 OK
Content-Type: text/plain
Cache-Control: no-cache
Content-Length: 2

This signals that the socket will close in about 12 seconds and another valid url should be requested before this time elapses.

20200511 : the new returned packet format is :

HTTP/1.1 200 OK
Content-Type: application/json
HTTaP-Session: gmahbf10
Cache-Control: no-cache
Content-Length: 37

{ "Remain": 7    ,  "Timeout": 10   }

Timeout is defined at startup and Remain helps detect jitter, as it should be very close to the "margin" in the JS code.