User Connections
User connection APIs operate on connections that completed pusher:signin.
Use these APIs when your backend needs to target or remove a user by user_id, regardless of which channels they joined.
#Send events to a user
POST https://api.vask.dev/apps/{app_key}/users/{user_id}/events{
"name": "notification.created",
"data": "{\"body\":\"Your report is ready\"}"
}The event is delivered to every active connection signed in as {user_id}.
Client binding:
pusher.signin();
pusher.user.bind('notification.created', (event) => {
console.log(event.body);
});#Terminate user connections
POST https://api.vask.dev/apps/{app_key}/users/{user_id}/terminate_connections{}Vask closes all active sockets signed in as {user_id} with close code 4200.
#Banning a user
Termination is immediate, but it does not permanently block reconnects. To ban a user:
- Update your application so future user auth requests for that user fail.
- Call
terminate_connectionsfor the sameuser_id.
If step 1 is skipped, the SDK can reconnect and sign in again.
#Presence is not enough
This API only affects connections that completed user authentication. A connection that joined a presence channel but never sent pusher:signin is not terminated by user id.
#Related docs
Prefer raw markdown? View this page as markdown.