Channels & presence

Socket ID

A socket ID identifies one live connection to a realtime service. It is a temporary connection identifier rather than a durable user or device identity.

Also found under: Connection ID, socket_id

How it works

Reconnects create a new connection, so application code should use the current socket ID when authorizing subscriptions. Multiple tabs belonging to one person have separate connections. Excluding a socket from an event excludes that connection only, not every device owned by the same user.

In a Pubb integration

Pubb uses socket_id when signing private and presence subscriptions. The publish API also accepts an optional socket_id to exclude one connection from event delivery.

Publish an event

A practical example

After immediately showing a user's own chat message, the backend may exclude the sending socket from the broadcast. The user's other subscribed devices can still receive the event.