Skip to content

Websocket

The atomicradio API has a Websocket server that exchanges data with every connected client via events. This server runs on the basis of Socket.IO. On our website and other services, metadata updates for our space are initially performed via an HTTP request; all further updates are performed via Socket.IO via the permanently open connection to the WebSocket server. Metadata updates are one of the many Socket.IO events supported by our API.

Our Socket.IO server is the preferred way to keep our data up to date across all our services.

To learn more about Websockets and Socket.IO, please visit the Socket.IO documentation: https://socket.io/docs/v4/

Connection

Our Socket.IO server allows connection via one of three options:

  • HTTP long polling
  • WebSocket
  • WebTransport

Furthermore, our Socket.IO server allows the query parameter token, which contains the user authorization token. This is only necessary if certain events that are reserved for authenticated users are to be received or sent. For more information about the authorization token, see Authentication. The token for the WebSocket connection is transferred without the word Bearer in front of the token.

If the connection to Socket.IO is successful, the API immediately begins exchanging data between the atomicradio API and the Socket.IO client. After the connection is established, the event update_space is immediately sent for each space to inform the new client that has just established its connection to the server about the current status of the spaces. You can find more information on this below at update_space Event.

Events

Here you will find information about our events that we can receive from the client or send from the server to the client.

update_space Event

The update_space event is used to inform the client about changes to information or metadata and to transmit the changes immediately. This event is executed for each client when connecting to the Socket.IO server and is only received by this new client. This event is triggered by broadcast for each Socket.IO client during each space update.

For each space, a separate update_space event is transmitted to the Socket.IO client. The event contains all data about the space and all metadata. The structure of the data is exactly the same as our HTTP router Get a Space in our API.

For more information on the structure of the data in the event, please refer to the Structure, Track Structure, and Example Space Structure to gain a thorough understanding of the data.