proto

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Implemenentation of GraphQL over WebSocket Protocol by apollographql https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md

Index

Constants

View Source
const (
	GQLUnknown OperationType = ""

	GQLConnectionClose = "connection_close"

	GQLConnectionInit      = "connection_init"
	GQLStart               = "start"
	GQLStop                = "stop"
	GQLConnectionTerminate = "connection_terminate"

	GQLConnectionError     = "connection_error"
	GQLConnectionAck       = "connection_ack"
	GQLData                = "data"
	GQLError               = "error"
	GQLComplete            = "complete"
	GQLConnectionKeepAlive = "ka"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Id      interface{}   `json:"id"`
	Payload *PayloadBytes `json:"payload"`
	Type    OperationType `json:"type"`
}

Generic Message type

func NewMessage

func NewMessage(id interface{}, payload interface{}, t OperationType) *Message

Creates new operation message

type OperationType

type OperationType string

OperationMessage type

type PayloadBytes

type PayloadBytes struct {
	Bytes []byte
	Value interface{}
}

Utility combining functionality of interface{} and json.RawMessage

func (*PayloadBytes) MarshalJSON

func (payload *PayloadBytes) MarshalJSON() ([]byte, error)

Serialize interface value

func (*PayloadBytes) UnmarshalJSON

func (payload *PayloadBytes) UnmarshalJSON(b []byte) error

Save bytes for later deserialization, just as json.RawMessage

type PayloadData

type PayloadData struct {
	Data   interface{} `json:"data"`
	Errors []error     `json:"errors"`
}

PayloadBytes for result of operation execution

type PayloadOperation

type PayloadOperation struct {
	Query         string                 `json:"query"`
	Variables     map[string]interface{} `json:"variables"`
	OperationName string                 `json:"operationName"`
}

PayloadBytes for operation parametrization

Jump to

Keyboard shortcuts

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