Events

All events are specific to the client or server. The server will not send client events, and your client should not send server events.

If a client sends an invalid event, the socket will be closed. However, you should ignore invalid events from the server as there may be some new events your client is not updated to use.

INVALID_PAYLOAD (Server)

Sent when you send an invalid payload to the server (duh).

{
    "event": "INVALID_PAYLOAD",
    "error": "Unknown `event`.", 
    "id": 1001
}
{
    "event": "INVALID_PAYLOAD",
    "error": "Invalid `token` for `HEY` event.",
    "id": 1001
}
etc

HELLO (Server)

This event is sent right after the client opens a websocket connection with the server to confirm the connection. The client is expected to reply to this with a HEY.

{
  "event": "HELLO"
}

HEY (Client)

After the HELLO event, the client sends a HEY event with an authentication token.

{
  "event": "HEY",
  "token": "11111111-1111-1111-1111-111111111111"
}

OH_YOU (Server)

You'll get OH_YOU right after sending a HEY and being successfully authenticated. You are expected to cache the user provided as there's literally no point to call GET /v1/users/@me if you have this cached. (Don't worry, the server will send you a YOU_CHANGED event if any of this information changes.)

{
    "event": "OH_YOU",
    "username": "Ben",
    "uuid": "004453070017000",
    "createdAt": 1629485870022,
    "pronouns": "he/him",
    "bio": "Just the owner of this thing",
    "flags": 1
}

SPOT_ADD (Server)

You'll get this event in one of two cases:

  1. You just sent a HEY and are getting information that you should cache

  2. You just joined a new spot.

{
    "name": "Velleity",
    "uuid": "004650040473001",
    "createdAt": 1629682840474,
    "members": [
        "004453070017000"
    ],
    "flags": 0,
    "ownerID": "004453070017000",
    "code": "056-e32-ff1",
    "event": "SPOT_ADD"
}

SPOT_REMOVE (Server)

You'll get this in a couple different cases:

  1. You left the server.

  2. You got kicked/banned from the server.

  3. The server was deleted.

For hopefully obvious privacy reasons, you cannot access a spot (or anything) after it's removed. This includes through the WebSocket. The payload will only provide the UUID of the spot and the event, so that you know what to remove from your cache.

{
    "uuid": "004650040473001",
    "event": "SPOT_REMOVE"
}

Last updated