Skip to content
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

Websocket: Avoid modifying protocol behaviour using URL params #194

Closed
FZambia opened this issue May 2, 2021 · 1 comment
Closed

Websocket: Avoid modifying protocol behaviour using URL params #194

FZambia opened this issue May 2, 2021 · 1 comment
Milestone

Comments

@FZambia
Copy link
Member

FZambia commented May 2, 2021

At this moment client that want to use JSON protocol should connect to:

ws://host:port/connection/websocket

To indicate an intent to use Protobuf protocol URL should look like:

ws://host:port/connection/websocket?format=protobuf

Also, to give server a tip about binary type of used data used inside frames:

ws://host:port/connection/websocket?format=protobuf&encoding=binary

A bit awkward and hard to explain/document.

The proposal here is get rid of URL parameters. Use explicit server configuration since the pattern when someone want different types of protocol/encoding for same server should be really rare. And can be solved by introducing another HTTP handler using this proposal.

On client side we will now have an explicit option with protocol type where applicable (at this moment Javascript and Go clients).

Ex.:

const centrifuge = new Centrifuge('ws://localhost:8000/connection/websocket', {
    protocol: 'protobuf'
})

This information will be negotiated with server using WebSocket subprotocol. So no URL param pollution.

For Centrifuge the user-payload encoding format is not important at all. So I think the encoding tip can be safely moved to Centrifugo (since v3 I suppose) and removed from Transport here.

@FZambia FZambia added this to the v1.0.0 milestone May 2, 2021
@FZambia FZambia changed the title Avoid modifying protocol behaviour using URL params Websocket: Avoid modifying protocol behaviour using URL params May 3, 2021
@FZambia FZambia modified the milestones: v1.0.0, v0.18.0 Jul 12, 2021
@FZambia
Copy link
Member Author

FZambia commented Aug 23, 2021

Done in 98f6388, will be part of v0.18.0

@FZambia FZambia closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant