-
Notifications
You must be signed in to change notification settings - Fork 0
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
Extract src/websockets from Polykey to js-ws #5
Conversation
We shouldn't kitchen sink PRs, Try do do them in a new PR if they're not required by changes in this one. |
When we are in a node environment, we are using the However, this event is not exposed in the |
Yea the browser will be considered a deficient environment. The API should look the same but we should be strict on creation where we throw errors for unimplemented features because of browser limitations. |
There will need to be new classes created, I'm in the process of doing so at the moment. The reason for the first being that in QUIC, a This will mean that the interfaces for
|
Furthermore, the creation of |
Feel free to ask me any questions about how the |
Only the server should be pinging, and the client responds with pongs. We do this as ping/ponging is not available on the window.WebSocket instance. However, browsers will automatically respond with pongs to server-sent pings, rather than exposing the feature to the user. Since we cannot control this behaviour, we have to implement similar behaviour on our WebSocketClient in a nodejs context. Or we can implement application-level ping/ponging. |
Ignore the browser environment for a moment. The websocket spec already defines how ping/pong works. I'm not actually sure which side is supposed to be sending the pings. Can you find out? Either way, keep alive mechanism must exist on both sides so that if the other side stops sending activity, we end up timing out. According to a quick search, browser websockets might actually be doing the keep alive internally already, so when using browser websockets, you just throw an exception when the parameter is set. Similar to what we talked about already about configuration not available on the browser. |
@amydevs update the spec above with all the changes that is required. Including the spec on how the ping will work between client and server as drawn on the whiteboard. |
for client - server ping-pong keep alive here's what should happen: this could be expanded upon by using the keepalive interval timer. |
af84a62
to
a0a44fa
Compare
Regarding benchmarking: iperf -s # server side
iperf -c 127.0.0.1 -l 1024 # client side Do this on your local system to test your localhost. Use the On the Linux OS, the kernel will set the underlying TCP buffer size. We don't need to change this. Get a baseline for just regular TCP doing the same thing, you can compare against Then use Then use Then use |
8889a59
to
f2f9895
Compare
i think i'm going to have to change how the TLS errors to be more specific rather than just internal, though the problem is that i can't really tell a socket error is because of a peer TLS failure in the case where verifyCallback is null, because ws simply errors that the server has dropped the socket |
i'll probably standardize the TLS errors like QUIC first and then document them |
d107589
to
7920417
Compare
Some things to port over from js-quic:
|
9e66e1d
to
f4c017a
Compare
f4c017a
to
d7006d9
Compare
… not allow for custom TLS verification
I've added inline documentation to WebSocketConnection: /**
* Note that on TLS verification failure, {@link events.EventWebSocketConnectionError} is emitted with the following `event.detail`:
* - If we failed to verify the peer, the `event.detail` will be an instance of {@link errors.ErrorWebSocketConnectionLocalTLS}.
* - If the peer failed to verify us, the `event.detail` will be an instance of {@link errors.ErrorWebSocketConnectionPeer} with an error code of {@link utils.ConnectionErrorCode.AbnormalClosure}.
*
* The reason for this is that when the peer fails to verify us, Node only tells us that the TCP socket has been reset, but not why.
*/ |
Hooray! |
Description
This PR moves
src/websockets
from https://github.com/MatrixAI/Polykey to this repository.It also implements backpressure and stream multiplexing according to the spec in #2.
Issues Fixed
src/websockets
from Polykey to js-ws #1Tasks
src/websockets
[ ] Allow for http server to be injected- no need for this because we are just going to focus on https onlyFinal checklist