Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewGraphQLTransportWS ¶
func NewGraphQLTransportWS() *graphqlTransportWS
func NewGraphQLWS ¶
func NewGraphQLWS() *graphqlWS
Types ¶
type Pinger ¶
type Pinger interface {
Ping(ctx context.Context, conn *websocket.Conn) error
Pong(ctx context.Context, conn *websocket.Conn) error
}
Pinger is an optional interface for protocols that support client-initiated ping/pong (e.g. graphql-transport-ws). Protocols that only have server-initiated keep-alive (e.g. legacy graphql-ws with ka messages) do not implement this.
type Protocol ¶
type Protocol interface {
// Init performs the connection handshake with the server.
Init(ctx context.Context, conn *websocket.Conn, payload map[string]any) error
// Subscribe starts a subscription for the given operation.
Subscribe(ctx context.Context, conn *websocket.Conn, id string, req *common.Request) error
// Unsubscribe ends a subscription.
Unsubscribe(ctx context.Context, conn *websocket.Conn, id string) error
// Read blocks until the next message arrives and decodes it.
Read(ctx context.Context, conn *websocket.Conn) (*WireMessage, error)
}
Protocol defines the message framing and behaviour used on a WS connection.
type WireMessage ¶
type WireMessage struct {
ID string
Type WireMessageType
Payload *common.ExecutionResult
Err error
}
WireMessage is a decoded wire-level protocol message. It is different from the common message format because it still contains the ID and internal type, which is not exposed to consumers.
func (*WireMessage) IntoClientMessage ¶
func (m *WireMessage) IntoClientMessage() *common.Message
type WireMessageType ¶
type WireMessageType uint8
WireMessageType identifies the message type.
const ( MessageData WireMessageType = iota MessageError MessageComplete MessagePing MessagePong )
func (WireMessageType) String ¶
func (t WireMessageType) String() string
Click to show internal directories.
Click to hide internal directories.