graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.GraphQL.Transport.WebSocket

Description

This file contains the handlers that are used within websocket server.

This module export three main handlers for the websocket server (onConn, onMessage, onClose), and two helpers for sending messages to the client (sendMsg, sendCloseWithMsg).

NOTE! The handler functions onClose, onMessage, etc. depend for correctness on two properties: - they run with async exceptions masked - they do not race on the same connection

Synopsis

Documentation

data OpDetail Source #

SubscriberDetails comes from addLiveQuery. We use this to track a connection's operations so we can remove them from LiveQueryState, and log.

NOTE!: This must be kept consistent with the global LiveQueryState, in onClose and onStart.

data WSLog Source #

Constructors

WSLog 

sendMsg :: MonadIO m => WSConn -> ServerMsg -> m () Source #

onConnInit Source #

Arguments

:: (MonadIO m, UserAuthentication (TraceT m)) 
=> Logger Hasura 
-> Manager 
-> WSConn 
-> AuthMode 
-> Maybe ConnParams 
-> WSOnErrorMessageAction WSConnData

this is the message handler for handling errors on initializing a from the client connection

-> WSKeepAliveMessageAction WSConnData

this is the message handler for handling "keep-alive" messages to the client

-> TraceT m ()