Skip to content

Allow dictionary as second param in WebSocket constructor #42

Open
@KhafraDev

Description

@KhafraDev

This would allow server environments (specifically talking about nodejs/undici) that implement WebSocket some flexibility, for example, to add custom headers, etc. While we could change it on our side, it would be incompatible with other implementations. Similarly, it'll cause type issues with people who use typescript in cross-env packages (ie. nodejs/undici#1943).

Proposed change:

dictionary WebSocketInit {
  protocols: DOMString or sequence<DOMString>
}

interface WebSocket : EventTarget {
  constructor(USVString url, optional (DOMString or sequence<DOMString> or WebSocketInit) options = []);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions