Skip to content

Protocol

Sein Coray edited this page Sep 12, 2016 · 3 revisions

IMPORTANT: Message contents are always sent base64 encoded!

Main Server <-> Client

Get the list of IPs with slave servers in the network where messages can be retrieved from:

Client: GTSRV
Server: GTSRV:{<ip,port>;<ip,port>;....}

Send a new message:

Client: NEMSG:<reciever>:<message>
Server: NEMSG:OK
Server: NEMSG:FAIL:<reason>

Get the available IDs:

Client: GTADD
Server: GTADD:{<id>;<id>;<id>;<id>,...}

Ping master server:

Client: SPING:<identifier>
Server: SPING:<identifier>

Slave Server <-> Client

Get the data from given IDs (calculated with defined method): The IDs are set or unset with 1/0 and ordered, so the GTMSG value has always the length of the number of IDs on the servers. The client will randomly set which IDs he wants.

Client: GTMSG:{(0|1)+}
Server: GTMSG:OK:<data>
Server: GTMSG:FAIL:<reason>

Main Server <-> Slave Server

Slave registers to the master.

Slave: REGIS:<ip>:<port>
Server: REGIS:OK
Server: REGIS:FAIL:<reason>

Slave server retrieves the new messages since he was online the last time. This is repeated until the slave is up to date.

Slave: DIFFM:<time>
Server: DIFFM:{<id>,<time>,<msg>;<id>,<time>,<msg>;<id>,<time>,<msg>;<id>,<time>,<msg>;...}
Server: DIFFM:DONE

Slave needs to complete the DIFFM synchronisation to get to the state of being ready, after this, the following commands can be executed.

Ping command should be executed regularly to check if the server is still online:

Slave: SPING:<time>
Server: SPING:<time>

Master distributes new messages to the slaves:

Server: NEMSG:<id>:<time>:<msg>
Slave: NEMSG:OK
Clone this wiki locally