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 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
Click to show internal directories.
Click to hide internal directories.