private-user-{user_id}. You can only subscribe to your own channel. Your user ID is the id in GET /me/. Public channels (event and event-{event_id}) do not require authorization.
Subscribing to a private channel needs a short-lived token. Request it from the Futuur API:
POST https://api.futuur.com/v1.5/realtime/auth/ works the same way. The endpoint uses the same authentication as the rest of the API: HMAC headers (Key, Timestamp, HMAC) for API users, or a session or JWT for the website. See Authentication for key setup and the required User-Agent header.
Request a token with HMAC
Send thechannel as a form field and sign it with your HMAC key, like any other request. The string to sign is every parameter — Key, Timestamp, and channel — sorted by name in case-sensitive code-point order, so the capitalized Key and Timestamp come first, then hashed with HMAC-SHA512 using your private key. For private-user-9 the signed string is exactly:
{"channel":"private-user-9"} works for session and JWT clients.
The response is:
{"detail": "..."} bodies:
Use the token
Send the token asauth in the subscribe operation:
error frame with code forbidden. See Overview.
Example: private channel in Python
This script subscribes to your ownprivate-user-{id} channel. It signs the token request with HMAC and asks for a fresh token on every connection. It resumes with since after a reconnect, and reconnects on a gap. It needs pip install websockets requests. Set PUBLIC_KEY, PRIVATE_KEY, and USER_ID first.
Python
Pusher authorization (deprecated)
Pusher requires an authorization token before a client can subscribe to a private channel. When subscribing, the Pusher client sendssocket_id and channel_name to your authorization endpoint.
API bots call Futuur’s channel authorization endpoint:
POST https://api.futuur.com/v2.0/pusher/user-auth/ is also available and unchanged. Authenticate with HMAC headers (Key, Timestamp, HMAC). The string to sign is every parameter — Key, Timestamp, channel_name, and socket_id — sorted by name in case-sensitive code-point order, so the capitalized Key and Timestamp come first:
private-user-{user_id} channel; any other private or presence channel returns 403. Your user ID is the id in GET /me/. Public channels (event and event-{event_id}) do not require authorization.
The endpoint returns {"auth": "..."} on success. Its errors are plain {"detail": "..."} bodies: 400 when channel_name or socket_id is missing, 401 when the HMAC check fails, 403 for a channel that is not yours.
Related
- Overview — the WebSocket gateway
- Channels and events — private user channel events
- Authentication — HMAC signing details