<aside> 💡 Production URL: wss://ws.trever.io
</aside>
Before making any authenticated calls to the API, the user needs to login through our auth
REST endpoint. The returned access_token
must be passed as an auth
message to an established websocket connection.
{
"type": "auth",
"data": {
"workspace": "<workspace>",
"token": "<access_token>"
}
}
{
"type": "auth_result",
"data": {
"success": true
}
}
Trever provides Ping/Pong messages to keep websockets alive. The client must send a ping
message over the websocket to the server, which responds with pong
. This should happen every 20s. If no message has been sent over the websocket for one minute, the connection is closed.
{
"type": "ping"
}
{
"type": "pong",
"data": {}
}
{
"type": "error",
"data": {
"code": 1234,
"message": "this is a error"
}
}
When connecting to a websocket endpoint please use the following headers:
Host: ws.trever.io
Connection: Upgrade
Upgrade: websocket