Closed Florry closed 7 years ago
One thought: Should we save userId with the socket connection rather than the JWT token and just fetch the user directly on each request? (Better performance and no jwt tokens stored anywhere, albeit just in memory) 🤔 EDIT: Although then a connection could outlive the jwt token 🤔
Adds the ability for websocket clients to make requests to the backend using
ws.post.hello.:userId
type endpoints. Syntax and data is meant to be as close to http requests as possible; meaning basically any http endpoint should be possible to expose as a websocket endpoint by changinghttp
tows
in the subject. Upon connecting to the websocket the JWT token and socket connection are paired and used for authentication on all requests similar to how API gateway does it for http requests. Responses are sent back to the client with structure:The fruster web bus client will have to make sure the response ends up at the right place (Pull request to come).
Adds endpoint to unregister client from websocket (e.g. on logout) either by providing user id to close all connections for that user account or jwt token to close only accounts for specific login. If a user makes a request and the token is invalid, any connection associated to that token is closed.
Makes it possible to send message to a list of user ids