Skip to main content

User connection status

The user:connection_status event fires whenever a user connects to, disconnects from, or logs out of the messaging service. Use this event to track user presence in real time on your app server.

For the complete webhook setup and signature verification guide, see Webhooks overview.

Event type

user:connection_status

Payload

Envelope

FieldTypeRequiredDescription
typeStringYes"user:connection_status"
idStringYesUnique event ID.
timeLongYesEvent generation time (Unix ms).
dataArrayYesArray containing one status object. See Data fields.

Data fields

FieldTypeRequiredDescription
statusStringYesConnection status change event. "0" = connected (online). "1" = disconnected (offline). "2" = logged out.
userIdStringYesThe user ID.
osStringNoClient platform. One of: iOS, Android, Websocket. Included when the user comes online.
timeLongYesTime of the status change (Unix ms).
clientIpStringNoThe user's current IP address and port (e.g., 192.168.1.100:12345).
sessionIdStringNoUnique connection ID. When a user is online on multiple devices simultaneously, each device has a distinct session ID.

Status values

ValueMeaning
"0"Connected — The client successfully connected to the messaging service.
"1"Disconnected — The client disconnected (app called disconnect, network interruption, or was kicked by another device login).
"2"Logged out — The client actively logged out (app called logout). Push notifications are suspended for this user after logout.
note

The status field represents a status change event, not the user's current state. For example, receiving "1" means the user just went offline, not that they are currently offline.

When a client loses connectivity abnormally (without sending an explicit disconnect), the offline event ("1") is delivered within 5 minutes.

Example

JSON
{
"type": "user:connection_status",
"id": "550e8400-e29b-41d4-a716-446655440001",
"time": 1730192400000,
"data": [
{
"status": "0",
"userId": "user_001",
"os": "iOS",
"time": 1730192400000,
"clientIp": "192.168.1.100:12345",
"sessionId": "sess_abc123"
}
]
}