Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendError ¶
func SendError(ctx *fasthttp.RequestCtx, code int, errors ...*gqlerror.Error)
SendError sends a best effort error to a raw response writer. It assumes the client can understand the standard json error response
func SendErrorf ¶
func SendErrorf(ctx *fasthttp.RequestCtx, code int, format string, args ...interface{})
SendErrorf wraps SendError to add formatted messages
Types ¶
type InitPayload ¶
type InitPayload map[string]interface{}
InitPayload is a structure that is parsed from the websocket init message payload. TO use request headers for non-websocket, instead wrap the graphql handler in a middleware.
func GetInitPayload ¶
func GetInitPayload(ctx context.Context) InitPayload
GetInitPayload gets a map of the data sent with the connection_init message, which is used by graphql clients as a stand-in for HTTP headers.
func (InitPayload) Authorization ¶
func (p InitPayload) Authorization() string
Authorization is a short hand for getting the Authorization header from the payload.
func (InitPayload) GetString ¶
func (p InitPayload) GetString(key string) string
GetString safely gets a string value from the payload. It returns an empty string if the payload is nil or the value isn't set.
type Websocket ¶
type Websocket struct { Upgrader websocket.FastHTTPUpgrader InitFunc WebsocketInitFunc KeepAlivePingInterval time.Duration PingPongInterval time.Duration // contains filtered or unexported fields }
func (Websocket) Do ¶
func (t Websocket) Do(r *fasthttp.RequestCtx, ctx context.Context, exec graphql.GraphExecutor)