graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Feature request: method to forcefully disconnect a websocket

Open Jamesits opened this issue 5 years ago • 3 comments

In current version of hasura, when the user token (whatever you pass to the auth hook) is revoked (e.g. user logged out remotely or user credential changed), any websocket already connected to hasura will still work and their access will not be revoked. I'd like to request a method to disconnect one or all the websockets from a certain user ID, so when the user automatically reconnect, their token will be re-verified by the auth hook.

Jamesits avatar Dec 30 '19 10:12 Jamesits

Currently we enforce the expiry of authorization information in JWT mode (the connection gets closed after the expiration time as specified in the JWT). This is lacking in the webhook mode, maybe the webhook can specify the expiry time of the session with Expires header?

I'd like to request a method to disconnect one or all the websockets from a certain user ID, so when the user automatically reconnect, their token will be re-verified by the auth hook.

This I feel should be added as a part of a larger 'subscription management' APIs for an admin user.

0x777 avatar Dec 30 '19 10:12 0x777

FYI, webhook mode respects Expires and Cache-Control values via https://github.com/hasura/graphql-engine/commit/5b54f9d76629383da854cc16fb9667ea36b96218

Read more here: https://hasura.io/docs/1.0/graphql/manual/auth/authentication/webhook.html#response

tirumaraiselvan avatar Jun 03 '20 04:06 tirumaraiselvan

This I feel should be added as a part of a larger 'subscription management' APIs for an admin user.

Any thoughts on adding something like this? We have a use case where when an admin revokes a user's access we need to terminate any subscriptions/websockets they may have w/o having to wait for the Expires condition to become true.

vincentjames501 avatar Oct 06 '22 14:10 vincentjames501

This I feel should be added as a part of a larger 'subscription management' APIs for an admin user.

Any thoughts on adding something like this? We have a use case where when an admin revokes a user's access we need to terminate any subscriptions/websockets they may have w/o having to wait for the Expires condition to become true.

Same case here!

gustavotrott avatar Mar 28 '23 13:03 gustavotrott