-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Feat: io client shared in socketdata #327
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Totodore
force-pushed
the
feat-io-client-in-socketdata
branch
from
June 4, 2024 14:29
c243451
to
9852110
Compare
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Totodore
force-pushed
the
feat-io-client-in-socketdata
branch
from
June 4, 2024 14:57
44ebe7f
to
d5eb45e
Compare
Totodore
force-pushed
the
feat-io-client-in-socketdata
branch
from
June 4, 2024 15:06
854597f
to
25ab9d5
Compare
This was referenced Jun 5, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Currently there is no way to access the
SocketIo
handle from a socket context / handler. The only solution is to store it as a static sharedOnceLock
in the application code. Having a way to access theSocketIo
handle from any context enable two things:Client
state rather than a static state. #317 by storing the state in the client and not as a shared internal static. We can then access it from anywhere.SocketIo
handle to use it as an extractor:Solution
The chosen solution is to store the
SocketIo
handle in the engine.io socketdata
. This allow for any socket to have it set at any time.One other way was to simply propagate the client reference to the handler when events were trigerred. However the main issue with this solution is that when events where trigger from the user side like calling
disconnect()
on a socket, the use would have to provide the io ref himself.Todo