Socket Endpoints
Documentation for xTimer API socket.io endpoints
Socket.io Endpoints
The xTimer API offers a Socket.io endpoint for real-time updates and interactions. This endpoint receives push messages from the server whenever there is a change in a room. These changes can be triggered by the controller page, the API, or the server itself.
Authentication
To authenticate with the Socket.io endpoint, include your room ID and API key in the auth object:
Connection Events
connect
Emitted when the socket successfully connects to the server.
disconnect
Emitted when the socket disconnects from the server.
connect_error
Emitted when a connection error occurs.
Room Events
room-name-updated
Emitted when the room name is updated.
room-timezone-updated
Emitted when the room timezone is updated.
settings-update
Emitted when room settings are updated.
blackout
Emitted when blackout mode is toggled.
focus-message
Emitted when focus message mode is toggled.
Timer Events
timer-started
Emitted when a timer is started.
timer-stopped
Emitted when a timer is stopped.
timer-reset
Emitted when a timer is reset.
timer-tweaked
Emitted when a timer's time is adjusted.
timer-created
Emitted when a new timer is created.
timer-update
Emitted when a timer is updated.
timer-deleted
Emitted when a timer is deleted.
timer-reorder
Emitted when timers are reordered.
timer-flash
Emitted when a flash is triggered.
timer-changed
Emitted when the active timer is changed.
timer-sync
Emitted when timer playback is synchronized.
Message Events
message-toggle
Emitted when a message's visibility is toggled.
message-created
Emitted when a new message is created.
message-updated
Emitted when a message is updated.
message-deleted
Emitted when a message is deleted.
message-reorder
Emitted when messages are reordered.
message-flash
Emitted when a message flash is triggered.
Client Events
client-rename
Emitted when a client is renamed.
force-reload
Emitted when a client is forced to reload.
kicked
Emitted when a client is kicked from the room.
Sending Events from Client to Server
The Socket.io API is primarily for receiving updates from the server. For sending commands to the server, use the HTTP API. However, socket connections do support some limited client-to-server communication for specific scenarios.
Client Identification
When connecting, clients can identify themselves with optional metadata:
This helps identify the client in the connected devices list.