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.
Hi @artem7902 - I saw you forked the repository to make it compatible with WebSocketServer servers. I think that's a reasonable thing for the core project to be compatible with, so I've made this PR to discuss your changes.
Your changes make the library mostly compatible, but it's still possible for somebody to make a https WebSocketServer, and because of this line, that won't be detected correctly (the library will communicate as http).
I wonder if instead it might be possible to access the underlying raw server here, though I see that there is no official API for this in
ws
(it could be done withserver._server
but that's not very future-proof). I raised a request on thews
project: websockets/ws#2068 — let's see what they think.Finally, it would of course be nice to get some basic testing for this compatibility, but I can pick that up if you're not interested.