protocol

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	// ConnectionID returns the connection id
	ConnectionID() string

	// Context returns the original connection request context
	Context() context.Context

	// WS returns the websocket
	WS() *websocket.Conn

	C() chan OperationMessage

	// ConnectionInitReceived
	ConnectionInitReceived() bool

	// Acknowledged
	Acknowledged() bool

	// ConnectionParams
	ConnectionParams() map[string]interface{}
}

type ExecutionResult

type ExecutionResult struct {
	Errors     gqlerrors.FormattedErrors `json:"errors,omitempty"`
	Data       interface{}               `json:"data,omitempty"`
	Path       []interface{}             `json:"path,omitempty"`  // patch result
	Label      *string                   `json:"label,omitempty"` // patch result
	HasNext    *bool                     `json:"hasNext,omitempty"`
	Extensions map[string]interface{}    `json:"extensions,omitempty"`
}

ExecutionResult result of an execution

type MessageType

type MessageType string

MessageType is a message type

const (
	// Common
	MsgConnectionInit MessageType = "connection_init"
	MsgConnectionAck  MessageType = "connection_ack"
	MsgError          MessageType = "error"
	MsgComplete       MessageType = "complete"

	// graphql-ws protocol specific
	MsgPing      MessageType = "ping"
	MsgPong      MessageType = "pong"
	MsgSubscribe MessageType = "subscribe"
	MsgNext      MessageType = "next"

	// graphql-transport-ws specific - deprecated protocol
	MsgKeepAlive           MessageType = "ka"
	MsgConnectionError     MessageType = "connection_error"
	MsgConnectionTerminate MessageType = "connection_terminate"
	MsgStart               MessageType = "start"
	MsgData                MessageType = "data"
	MsgStop                MessageType = "stop"
)

type OperationMessage

type OperationMessage struct {
	ID      string      `json:"id,omitempty"`
	Type    MessageType `json:"type"`
	Payload interface{} `json:"payload,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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