Android app: pass API key token on WebSocket connection #2
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
offsite.guru/textze#2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The server now requires authentication on the WebSocket endpoint (
/ws/{device_id}). Atokenquery parameter with a valid API key must be provided, otherwise the connection is closed with code 1008.The Android app currently connects without a token, so real-time push notifications (new message alerts, delivery status updates) are broken. SMS sending and receiving still work since those use authenticated HTTP endpoints.
Fix
In
WebSocketManager.java, theinitialize()method builds the URL as:It needs to include the API key:
The
apiKeyis already available in the app (used bySmsApiClientfor REST calls) — it just needs to be passed intoWebSocketManager.initialize()and appended to the URL.Labels
android, server
Closed by commit
7151014— WebSocket connections now pass the API key as a query token parameter.