Each client needs to start the connection by initiating a handshake process immediately after opening the WebSocket connection. The handshake process will define which channel the client is connecting.
To receive history from a room, the user must first turn on message history for the channel from the dashboard. After enabling it the user can ask for up to 100 of the latest messages from a room when subscribing.
If the JWT authentication defines a lower number of history items than what the user is asking for themselves, the lower number will be used.
The messages are returned with an index parameter indicating their order. You might receive messages in a different order than 0..n. It's up to the API client to make sure they are delivered to the user in that order.
History Message
Server → Client
Property
Datatype
Example value
Required
Comment
type
string
history_message
✓
id
string
6YJ7WoiDgs
✓
UID to identify the message
client_id
string
hCzb:J2Fn
✓
UID to identify the client
index
integer
0
✓
Index of the returned message. Used for maintaining the order of messages from the history. Message with index 0 is the latest and should be delivered to the user first.
message
JSON/string/number
Hello world
✓
Message sent to the room
room
string
myRoom1
✓
Room name
timestamp
integer
1528814484
✓
Unix timestamp when the message was originally sent