[GH-ISSUE #1620] Support setting the Sec-WebSocket-Protocol header on WebSocket connections #512

Closed
opened 2026-03-16 15:47:53 +03:00 by kerem · 2 comments
Owner

Originally created by @oshoham on GitHub (Apr 27, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1620

Is your feature request related to a problem? Please describe.
I sometimes use the Sec-WebSocket-Protocol header to authenticate WebSocket endpoints, and I think it'd be great if Hoppscotch supported setting that particular header on WebSocket connections.

I'm aware of the existing discussions around setting headers on WebSocket connections and that that's not likely to happen, but Sec-WebSocket-Protocol is the only header that the browser WebSocket API explicitly allows programmers to set (via the 2nd argument to the WebSocket constructor).

Please consider making an exception for this particular header, as I think that it merits being considered separately from the question of whether to allow setting arbitrary headers on WebSocket connections.

Describe the solution you'd like
I'd like to see an additional field in the WebSocket pane that allows the user to input a value for the Sec-WebSocket-Protocol header to be set on the WebSocket connection when it is established.

Describe alternatives you've considered
I'm aware that there are other approaches to authenticating WebSocket connections, e.g. using a query parameter, but Sec-WebSocket-Protocol is a widely-supported part of the browser WebSocket API.

Originally created by @oshoham on GitHub (Apr 27, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1620 **Is your feature request related to a problem? Please describe.** I sometimes use the `Sec-WebSocket-Protocol` header to authenticate WebSocket endpoints, and I think it'd be great if Hoppscotch supported setting that particular header on WebSocket connections. I'm aware of the existing discussions around setting headers on WebSocket connections and that that's not likely to happen, but `Sec-WebSocket-Protocol` is the only header that the browser WebSocket API explicitly allows programmers to set (via the 2nd argument to the [WebSocket constructor](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket)). Please consider making an exception for this particular header, as I think that it merits being considered separately from the question of whether to allow setting arbitrary headers on WebSocket connections. **Describe the solution you'd like** I'd like to see an additional field in the WebSocket pane that allows the user to input a value for the `Sec-WebSocket-Protocol` header to be set on the WebSocket connection when it is established. **Describe alternatives you've considered** I'm aware that there are other approaches to authenticating WebSocket connections, e.g. using a query parameter, but `Sec-WebSocket-Protocol` is a widely-supported part of the browser WebSocket API.
kerem 2026-03-16 15:47:53 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@liyasthomas commented on GitHub (Apr 28, 2021):

Will look into this.

<!-- gh-comment-id:828067406 --> @liyasthomas commented on GitHub (Apr 28, 2021): Will look into this.
Author
Owner

@liyasthomas commented on GitHub (Jun 15, 2021):

Hoppscotch now supports Sec-WebSocket-Protocol headers on WebSocket connections.

<!-- gh-comment-id:861556421 --> @liyasthomas commented on GitHub (Jun 15, 2021): Hoppscotch now supports `Sec-WebSocket-Protocol` headers on WebSocket connections.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#512
No description provided.