Documentation ¶
Overview ¶
Package transportws implements the subscriptions-transport-ws protocol.
Index ¶
Constants ¶
View Source
const ProtocolName = "graphql-ws"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Protocol ¶
type Protocol struct { // InitFunc is called after receiving the "connection_init" message with the // WebSocket handshake HTTP request and the message payload. // // The returned Context, if not nil, is provided to GraphQL resolvers. When // the Context is done, the connection is also closed. // // The returned ObjectPayload, if not nil, is used as the payload for the // "connection_ack" message. // // If a non-nil error is returned, the connection is closed. // // If InitFunc is nil, all connections are accepted. InitFunc func(*http.Request, wsutil.ObjectPayload) (context.Context, wsutil.ObjectPayload, error) // InitTimeout is the duration to wait for a "connection_init" message before // closing the connection. // // Defaults to 3 seconds. InitTimeout time.Duration // If KeepAliveInterval is set, a "ka" message is sent if no message is // received for the specified duration. KeepAliveInterval time.Duration // AcceptOptions defines options used during the WebSocket handshake. AcceptOptions websocket.AcceptOptions }
Protocol implements the subscriptions-transport-ws protocol described here: https://github.com/apollographql/subscriptions-transport-ws.
Protocol can be used as a gqlgenws.Protocol or directly as a gqlgen transport.
func (*Protocol) Do ¶
func (p *Protocol) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor)
Click to show internal directories.
Click to hide internal directories.