-
-
Notifications
You must be signed in to change notification settings - Fork 895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emitting with callback outside request context #1324
Comments
You can only use a callback when you emit to a single client.
I don't understand this. What other way did you expect to find besides explicitly mentioning who is the client you want to emit to? That is really the only way. |
No other way. Did you read what I had written? Here I am saying that I AM doing this:
Once more: You have a missing call to |
Sorry, I did not interpret what you were saying correctly. When you said "I did not find a way... other than passing the sid" I assumed you were saying that passing the sid works, but you needed an alternative way w/o passing the sid. English is ambiguous sometimes. The only problem is that I forgot the |
- Added proper call to has_request_context function
Sorry for late response, I've created pull request to the master branch :) |
- Added proper call to has_request_context function Co-authored-by: igor_kantorski <[email protected]>
Describe the bug
Okay, so I am using outside-of-context
emit
documented here. I am passing an acknowledge callback, like this:This emit is done outside of request context. Documentation states that:
Actually, I am doing that. I did not found a way to address individual client outside of request context other than passing session ID to the
room
argument.As documentation stays:
And I am doing that as well. Instead of emitting an event, an exception is raised telling that I am working outside of request context:
Which clearly is caused by this line. I think that cause of this is that You actualy testing for Truth actual function instance and missed call to
has_request_context()
function a line above that.To Reproduce
Here, some small piece of code to reproduce:
Expected behavior
No error are raised, event is emitted, acknowledge handlers are registered without pushing request context over.
Additional context
Example works fine when using this class:
BUT I AM NOT SURE IF THIS IS ENOUGH for everything to work ;) Correct me if I am wrong.
The text was updated successfully, but these errors were encountered: