-
Notifications
You must be signed in to change notification settings - Fork 64
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
[typescript] Allow client to understand other subprotocols #916
Conversation
* A list subprotocols supported by this client. Typically, this will agree with the subprotocols | ||
* advertised by the provided `IWebSocket` implementation. | ||
*/ | ||
protected supportedSubprotocols: string[] = [FoxgloveClient.SUPPORTED_SUBPROTOCOL]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUPPORTED_SUBPROTOCOL
is public, so arguably this should be too, but I'm not sure why the former is (or if it still needs to be).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, maybe we should just delete this check? I don’t think it’s really necessary anyway as the underlying WebSocket will handle the protocol as part of the handshake
I think that's reasonable. I presume this is a check to make sure the provided ws client is advertising a subprotocol that this library understands (and so can provide a better error), but we could document instead. |
I updated the PR and description to remove the check entirely. |
Co-authored-by: Jacob Bandes-Storch <jacob@foxglove.dev>
### Changelog Remove the explicit check for a supported subprotocol in `FoxgloveClient`. Rely on the WS client to advertise the correct value and the handshake to enforce it. ### Description Version bump for #916
Changelog
None
Docs
None
Description
This removes the "supported subprotocol" check performed after the handshake, instead relying on the underlying websocket client to advertise the correct subprotocol.
The
FoxgloveClient
already accepts a websocket client (IWebSocket
), which is free to choose its advertised subprotocols. This change would allow it to be extended with backwards-compatible subprotocols (for example, v2).This change is not breaking as long as existing clients are advertising the correct subprotocol.