forked from wundergraph/graphql-go-tools
-
Notifications
You must be signed in to change notification settings - Fork 4
/
graphql_ws_proto_types.go
45 lines (36 loc) · 1.18 KB
/
graphql_ws_proto_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package graphql_datasource
// common
var (
connectionInitMessage = []byte(`{"type":"connection_init"}`)
)
const (
messageTypeConnectionAck = "connection_ack"
messageTypeComplete = "complete"
messageTypeError = "error"
)
// websocket sub-protocol:
// https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md
const (
ProtocolGraphQLWS = "graphql-ws"
startMessage = `{"type":"start","id":"%s","payload":%s}`
stopMessage = `{"type":"stop","id":"%s"}`
messageTypeConnectionKeepAlive = "ka"
messageTypeData = "data"
messageTypeConnectionError = "connection_error"
)
// websocket sub-protocol:
// https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
const (
ProtocolGraphQLTWS = "graphql-transport-ws"
subscribeMessage = `{"id":"%s","type":"subscribe","payload":%s}`
pongMessage = `{"type":"pong"}`
completeMessage = `{"id":"%s","type":"complete"}`
messageTypePing = "ping"
messageTypeNext = "next"
)
// internal
const (
internalError = `{"errors":[{"message":"internal error"}]}`
connectionError = `{"errors":[{"message":"connection error"}]}`
errorMessageTemplate = `{"errors":[{"message":"%s"}]}`
)