-
Notifications
You must be signed in to change notification settings - Fork 0
Socket Protocol
The socket server supports graphic and command based clients through a custom protocol. Graphic clients receive PNG data of screen changes and command clients receive commands processed by the renderer to be rendered by the client. Both clients receive a PNG of the current screen at the beginning of the connection via a graphics command, and a periodic heartbeat command.
When a connection is established, the server expects to receive 11 bytes from the client. The ascii bytes should either be "graphicmode" or "commandmode" to communicate to the server which type of client has connected. After this transmission, the client no longer sends any data to the server and all further communications will be the server sending commands to the client.
The transmissions from the server to the client is in the format CCCCDDDDcommandData
- CCCC is a 32-bit signed integer in binary containing the length of the command.
- DDDD is a 32-bit signed integer in binary containing the length of the data.
- command is the command to render.
- Data is the data for the command to use.
graphics
Image data to place on the screen.
When a client connects to the server, this command is sent for the entire screen. Afterwards, it is only sent to graphic clients.
The command is in the format graphics X,Y,Width,Height
- X and Y is the location to place the image.
- Width and Height is the size of the image.
The data is a binary PNG image.
heartbeat
This is sent by the server every 60 seconds if there is no other activity.
There is no data used by this command. DDDD will be an integer 0.
clear
Clear the screen.
There is no data used by this command. DDDD will be an integer 0.
Applies to command clients only.
image
Add an image from a local file.
The data is a json document for the image command.
Applies to command clients only.
draw
Draw an SVG image on the screen.
The data is a json document for the draw command.
Applies to command clients only.
text
Add text to the screen.
The data is a json document for the text command.
Applies to command clients only.