graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.GraphQL.Transport.WebSocket.Server

Synopsis

Documentation

data WSId Source #

Instances

Instances details
ToJSON WSId Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Show WSId Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

showsPrec :: Int -> WSId -> ShowS #

show :: WSId -> String #

showList :: [WSId] -> ShowS #

Eq WSId Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

(==) :: WSId -> WSId -> Bool #

(/=) :: WSId -> WSId -> Bool #

Hashable WSId Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

class Monad m => MonadWSLog m where Source #

Methods

logWSLog :: Logger Hasura -> WSLog -> m () Source #

Takes WS server log data and logs it logWSServer

Instances

Instances details
MonadWSLog AppM Source # 
Instance details

Defined in Hasura.App

Methods

logWSLog :: Logger Hasura -> WSLog -> AppM () Source #

MonadWSLog m => MonadWSLog (ExceptT e m) Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

logWSLog :: Logger Hasura -> WSLog -> ExceptT e m () Source #

MonadWSLog m => MonadWSLog (ReaderT r m) Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

logWSLog :: Logger Hasura -> WSLog -> ReaderT r m () Source #

data WSConn a Source #

data WSServer a Source #

Constructors

WSServer 

Fields

closeAllConnectionsWithReason :: WSServer a -> String -> ByteString -> (SecuritySensitiveUserConfig -> SecuritySensitiveUserConfig) -> IO () Source #

data AcceptWith a Source #

Constructors

AcceptWith !a !AcceptRequest !(WSConn a -> IO ()) !(WSConn a -> IO ()) 

type WSKeepAliveMessageAction a = WSConn a -> IO () Source #

These set of functions or message handlers is used by the server while communicating with the client. They are particularly useful for the case when the messages being sent to the client are different for each of the sub-protocol(s) supported by the server.

data WSActions a Source #

Used for specific actions within the onConn and onMessage handlers

Constructors

WSActions 

Fields

type HasuraServerApp m = IpAddress -> PendingConnection -> m () Source #

aka generalized ServerApp over m, which takes an IPAddress

data WSHandlers m a Source #

NOTE: The types of _hOnConn and _hOnMessage were updated from OnConnH and OnMessageH because we needed to pass the subprotcol here to these methods to eventually get to OnConnH and OnMessageH. Please see createServerApp to get a better understanding of how these handlers are used.

Constructors

WSHandlers (WSId -> RequestHead -> IpAddress -> WSSubProtocol -> m (Either RejectRequest (AcceptWith a))) (WSConn a -> ByteString -> WSSubProtocol -> m ()) (OnCloseH m a) 

websocketConnectionReaper :: IO (AuthMode, AllowListStatus, CorsPolicy, SQLGenCtx, HashSet ExperimentalFeature, NamingCase) -> IO SchemaCache -> WSServer a -> IO Void Source #

The background thread responsible for closing all websocket connections when security sensitive user configuration changes. It checks for changes in the auth mode, allowlist, cors config, stringify num, dangerous boolean collapse, stringify big query numeric, experimental features and invalidates/closes all connections if there are any changes.

createServerApp Source #

Arguments

:: (MonadIO m, MonadBaseControl IO m, Forall (Pure m), MonadWSLog m) 
=> IO MetricsConfig 
-> WSConnectionInitTimeout 
-> WSServer a 
-> PrometheusMetrics 
-> WSHandlers m a

user provided handlers

-> HasuraServerApp m

aka WS.ServerApp