The Smart Device Client uses a WebSocket-based protocol powered by Socket.IO to facilitate real-time communication between devices in a meeting. This document describes the connection process, supported events, and command formats.
Clients connect to the server using Socket.IO at the
/io namespace. The connection requires two query
parameters:
meetId (string): The unique identifier for the meeting
room.
email (string): The client's email address for
identification.
Example connection (JavaScript):
const socket = io('/io', {
query: { meetId: 'room1', email: 'user1@example.com' }
});
| Event | Description | Payload |
|---|---|---|
connect |
Triggered when the client successfully connects to the server. | None |
connectionError |
Triggered if the connection fails (e.g., missing query parameters). | { message: string } |
deviceConnected |
Triggered when a device joins the meeting. |
{ deviceId: string, email: string, meetId: string, totalDevices: number }
|
deviceDisconnected |
Triggered when a device leaves the meeting. |
{ deviceId: string, email: string, meetId: string, totalDevices: number }
|
deviceMessage |
Triggered when a device broadcasts a message. |
{ senderId: string, senderEmail: string, message: string, timestamp: string }
|
control |
Triggered when a control command is received. |
{ senderId: string, senderEmail: string, command: string, data?: any, timestamp: string }
|
controlError |
Triggered if a control command fails (e.g., invalid JSON). | { message: string } |
deviceList |
Triggered in response to getDeviceList, listing all
connected devices.
|
{ devices: [{ id: string, email: string }], total: number, meetId: string }
|
| Event | Description | Payload |
|---|---|---|
getDeviceList |
Requests the list of connected devices in the meeting. | None |
broadcast |
Sends a message to all devices in the meeting. | string |
control |
Sends a control command to a specific device. |
{ targetEmail: string, command: string, data?: any }
|
Control commands sent via the control event must include:
targetEmail (string): The email of the target device.
command (string): The command name (e.g.,
mute, pause, custom).
data (optional, any): Additional data in valid JSON
format.
Example valid control command:
socket.emit('control', {
targetEmail: 'user2@example.com',
command: 'custom',
data: { command: 'stop' }
});
Invalid JSON in data (e.g., {command:"stop"})
will trigger a controlError event.
meetId and email are provided during
connection.
/ to join meetings, send
broadcasts, and issue control commands.
data field to
avoid errors.