datadvance / DjangoChannelsGraphqlWs

Django Channels based WebSocket GraphQL server with Graphene-like subscriptions
MIT License
281 stars 84 forks source link

@prokher We are using the recommended way to set the user on scope described above but could notice on production that `subscribe` functions sometimes execute prior to `on_connect`, at which point the scope is not populated. #75

Open SebasWilde opened 3 years ago

SebasWilde commented 3 years ago

@prokher We are using the recommended way to set the user on scope described above but could notice on production that subscribe functions sometimes execute prior to on_connect, at which point the scope is not populated.

We've attributed this to subscriptions-transport-ws not waiting for connection ack to initiate subscriptions (and the lack of an option to do so), thus we've enabled strict_ordering on the consumer in order to make sure that the scope is populated when subscriptions are run.

Is there anything else we could do instead? I should mention that we are initializing multiple objects on the scope so there is a benefit to doing it once on connection. Thanks!

Originally posted by @fmoga in https://github.com/datadvance/DjangoChannelsGraphqlWs/issues/23#issuecomment-770979144

tony commented 2 years ago

What error does this usually raise?

e.g. does it say the user is logged out? that info.context.user has an AttributeError?