postgrest-ws-0.2.0.0: PostgREST extension to map LISTEN/NOTIFY messages to Websockets

Safe HaskellNone
LanguageHaskell2010

PostgRESTWS.Database

Description

 

Synopsis

Documentation

notifyPool :: Pool -> ByteString -> ByteString -> IO (Either Error ()) Source #

Given a Hasql Pool, a channel and a message sends a notify command to the database

notify :: Connection -> ByteString -> ByteString -> IO (Either Error ()) Source #

Given a Hasql Connection, a channel and a message sends a notify command to the database

listen :: Connection -> ByteString -> IO () Source #

Given a Hasql Connection and a channel sends a listen command to the database

unlisten :: Connection -> ByteString -> IO () Source #

Given a Hasql Connection and a channel sends a unlisten command to the database

waitForNotifications :: (ByteString -> ByteString -> IO ()) -> Connection -> IO () Source #

Given a function that handles notifications and a Hasql connection forks a thread that listens on the database connection and calls the handler everytime a message arrives.

The message handler passed as first argument needs two parameters channel and payload.