Skip to content

Conversation

@maghamalyan
Copy link

There are cases when you want to accept connection on connect event and then after that do some additional work, for example send the latest updates to user which has just authenticated. This is not possible to do on connect event because in order to send events to the client you need to accept it's connection but for that you need to return from connect event handler and thus you cannot do anything after return.
Without this event you are forced to do this by either accepting all connections and doing authentication on another event or setting up messaging broker and delaying tasks from connect event for example with celery.

There are cases when you want to accept connection on connect event and then after that do some additional work, for example send the latest updates to user which has just authenticated. This is not possible to do on connect event because in order to send events to the client you need to accept it's connection but for that you need to return from connect event handler and thus you cannot do anything after return.
Without this event you are forced to do this by either accepting all connections and doing authentication on another event or setting up messaging broker and delaying tasks from connect event for example with celery.
@miguelgrinberg
Copy link
Owner

You can emit events from a connect handler actually. Have you tried?

@maghamalyan
Copy link
Author

No, but I will try.
Thanks

@maghamalyan maghamalyan closed this Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants