Documentation
Server
Functions
handleProtocols

Function: handleProtocols()

handleProtocols(protocols): typeof GRAPHQL_TRANSPORT_WS_PROTOCOL | false

Defined in: src/server.ts:930

Helper utility for choosing the “graphql-transport-ws” subprotocol from a set of WebSocket subprotocols.

Accepts a set of already extracted WebSocket subprotocols or the raw Sec-WebSocket-Protocol header value. In either case, if the right protocol appears, it will be returned.

By specification, the server should not provide a value with Sec-WebSocket-Protocol if it does not agree with client’s subprotocols. The client has a responsibility to handle the connection afterwards.

Parameters

protocols

string | string[] | Set<string>

Returns

typeof GRAPHQL_TRANSPORT_WS_PROTOCOL | false