The Gateway is the connector for all Utilbot Applications, such as the Bot itself or the Website. The communication takes place over secure WebSockets. The Gateway should only be used via our official Applications, but you can implement your own client, if you want.
? --> Field is optional.
The Gateway is reachable via
wss://gateway.utilbot.co. You can connect via a normal websocket. You must convert everything you send into a JSON String to send it to the Server. Data, that is not in the json format, will be truncated.
|v||integer||Gateway Version||see gateway versions|
|compression?||string||The (optional) compression of packets||'zlib'|
Example Connection strings:
When the connection was successful, you should recieve the Hello Opcode 5 paylod, with the heartbeat interval:
After recieving the Hello, you must start sending the Heartbeat Opcode 10 every
heartbeat milliseconds. When the Gateway recieves this Heartbeat, it will send you an ACK via the ACK Opcode 11. If you stop recieving this ACK, you must reconnect to the Gateway.
When the Gateway doesn't recieve a Heartbeat when the next one should be sent, it closes the Connection with the Error Code 4006.
Example Heartbeat ACK
After you started sending the Hearbeats, you must send the Identify Event. This is done via the Event Send Opcode 1. Any data you send before Identifying will be ignored and never answered.
When everything is valid, you will get a response with the Connection Success Event