wstransport

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package wstransport implements common gqlgen WebSocket transports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Negotiator

type Negotiator struct {
	// Default is used when a client does not request any specific protocol.
	//
	// Default can be nil.
	Default gqlgenws.Protocol

	// Protocols contains all supported protocols using their name as the key.
	Protocols map[string]gqlgenws.Protocol

	// AcceptOptions defines options used during the WebSocket handshake.
	AcceptOptions websocket.AcceptOptions
}

Negotiator is a gqlgen transport that accepts WebSocket connections.

Negotiator negotiates a protocol with the client based on its registered protocols then delegates connection handling to the protocol.

Negotiator returns an error to the client if no acceptable transport is found.

func NewNegotiator

func NewNegotiator(def gqlgenws.Protocol, protocols ...gqlgenws.Protocol) *Negotiator

NewNegotiator creates a Negotiator with the provided default protocol and any extra protocol supplied.

func (*Negotiator) Do

func (*Negotiator) Supports

func (n *Negotiator) Supports(r *http.Request) (res bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL