-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Streaming: Rework websocket server initialisation & authentication code #28631
Streaming: Rework websocket server initialisation & authentication code #28631
Conversation
9945fb3
to
cab6f7a
Compare
cab6f7a
to
0818b51
Compare
Looks fine overall, but I'd prefer keeping the |
I hear you, but there's a reason this was originally all done in the logging change, because these are all strongly related, imo. |
I still don't understand why it's part of this commit and not the other one… I don't understand what requires the |
@ClearlyClaire just to clarify, are you saying this won't be merged as long as the request ID changes are in here? And that you want me to spend 30-60 minutes to pick those out just to do them in another already opened pull request that this was split from at Renauld's request? Because that's going to delay being able to move forwards with this until I have the time & energy to do those additional changes. |
I prefer if we don't add an unnecessary regression, however small and temporary. I can try and take this PR over if you prefer. |
This moves us away from the deprecated verifyClient mechanism, towards using a custom 'upgrade' event handler as recommended by the author of the ws module. In the future, we could even move towards using a custom WebSocket subclass to add in additional methods and data directly to the WebSocket instance.
0818b51
to
bc5931b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #28631 +/- ##
==========================================
+ Coverage 84.77% 84.84% +0.06%
==========================================
Files 1039 1038 -1
Lines 28162 28152 -10
Branches 4541 4534 -7
==========================================
+ Hits 23875 23886 +11
+ Misses 3129 3103 -26
- Partials 1158 1163 +5 ☔ View full report in Codecov by Sentry. |
@ClearlyClaire have finished rebasing this, and also #27828 — hopefully these are both good to go now. |
This moves us away from the deprecated verifyClient mechanism, to using a custom 'upgrade' event handler as recommended by the author of the
ws
module.In the future, we should probably move towards using a custom WebSocket subclass to add in additional methods and data directly to the WebSocket instance, by passing the
WebSocket
option, which would give a cleaner abstraction for the logger and other data we may want to attach to the websocket, such asisAlive
— you can see what that'll look like in this branch: https://github.com/mastodon/mastodon/compare/main...ThisIsMissEm:mastodon:experimental/custom-eventsource-and-websocket-classes?expand=1