subprotocol

package
v0.0.0-...-8603776 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphQLWS

type GraphQLWS struct {
	Origin            GraphQLWSOrigin
	Cluster           GraphQLWSCluster
	KeepAliveInterval time.Duration
	Logger            logrus.FieldLogger
	// contains filtered or unexported fields
}

GraphQLWS implements the graphql-ws subprotocol. It can be used as a middle layer between the websocket service and an origin to provide a more efficient, higher level interface to the origin.

func (*GraphQLWS) Address

func (sp *GraphQLWS) Address() wss.Address

func (*GraphQLWS) Close

func (sp *GraphQLWS) Close() error

func (*GraphQLWS) HandleGraphQLWSServiceRequest

func (sp *GraphQLWS) HandleGraphQLWSServiceRequest(r *GraphQLWSServiceRequest)

func (*GraphQLWS) SendOriginRequest

func (sp *GraphQLWS) SendOriginRequest(r *wss.OriginRequest) error

func (*GraphQLWS) SendServiceRequest

func (sp *GraphQLWS) SendServiceRequest(address wss.Address, r *wss.ServiceRequest) error

func (*GraphQLWS) ServeHTTP

func (sp *GraphQLWS) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GraphQLWSCluster

type GraphQLWSCluster interface {
	Address() wss.Address

	SendGraphQLWSServiceRequest(address wss.Address, r *GraphQLWSServiceRequest) error
}

type GraphQLWSOrigin

type GraphQLWSOrigin interface {
	SendGraphQLWSOriginRequest(*GraphQLWSOriginRequest) (*GraphQLWSOriginResponse, error)
}

type GraphQLWSOriginFunc

type GraphQLWSOriginFunc func(*GraphQLWSOriginRequest) (*GraphQLWSOriginResponse, error)

func (GraphQLWSOriginFunc) SendGraphQLWSServiceRequest

func (f GraphQLWSOriginFunc) SendGraphQLWSServiceRequest(r *GraphQLWSOriginRequest) (*GraphQLWSOriginResponse, error)

type GraphQLWSOriginRequest

type GraphQLWSOriginRequest struct {
	Sender wss.Address

	StartRequest *GraphQLWSStartRequest

	SubscriptionQueryRequest *GraphQLWSSubscriptionQueryRequest

	SubscriptionKeepAliveRequest *GraphQLWSSubscriptionKeepAliveRequest
}

type GraphQLWSOriginResponse

type GraphQLWSOriginResponse struct {
	Error        string
	Result       *GraphQLWSResult
	Subscription *GraphQLWSSubscription
}

type GraphQLWSPublishRequest

type GraphQLWSPublishRequest struct {
	Subscribers []wss.Address
	Keys        []string
	Context     json.RawMessage
}

type GraphQLWSResult

type GraphQLWSResult struct {
	Data   json.RawMessage
	Errors json.RawMessage `json:"Errors,omitempty"`
}

type GraphQLWSServiceRequest

type GraphQLWSServiceRequest struct {
	WebSocketServiceRequest *wss.ServiceRequest

	PublishRequest *GraphQLWSPublishRequest
}

type GraphQLWSStartRequest

type GraphQLWSStartRequest struct {
	Query         string
	Variables     json.RawMessage
	OperationName string
}

type GraphQLWSSubscription

type GraphQLWSSubscription struct {
	// A digest that uniquely identifies the inputs to the query. This is used to batch query
	// execution.  Generally, this should be a hash of the normalized query, variables, and
	// operation name.
	InputDigest string

	InputContext json.RawMessage

	// A list of keys that will be used to trigger this subscription's execution in the future.
	Keys []string
}

type GraphQLWSSubscriptionKeepAliveRequest

type GraphQLWSSubscriptionKeepAliveRequest struct {
	Keys []string
}

type GraphQLWSSubscriptionQueryRequest

type GraphQLWSSubscriptionQueryRequest struct {
	Query         string
	Variables     json.RawMessage
	OperationName string
	Context       json.RawMessage
	InputContext  json.RawMessage
}

Jump to

Keyboard shortcuts

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