reflex-backend-socket-0.2.0.1: Reflex bindings for TCP sockets
Copyright(c) 2018-2019 Commonwealth Scientific and Industrial Research Organisation
LicenseBSD3
Maintainerdave.laing.80@gmail.com, jack.kelly@data61.csiro.au
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Reflex.Backend.Socket.Accept

Description

Use accept to create listen sockets, and get an Event t Socket of new connections.

Synopsis

Documentation

accept Source #

Arguments

:: (Reflex t, PerformEvent t m, PostBuild t m, TriggerEvent t m, MonadIO (Performable m), MonadIO m) 
=> AcceptConfig t 
-> m (Event t (Either SetupError (Accept t)))

This event will fire exactly once.

Create a listening socket. Sockets are accepted in a background thread.

Listen socket configuration

data AcceptConfig t Source #

Configuration of a listen socket.

Constructors

AcceptConfig 

Fields

Results of accept

data Accept t Source #

Events produced by a running listen socket.

Constructors

Accept 

Fields

  • _aAcceptSocket :: Event t (Socket, SockAddr)

    A new connection was accepted, including its remote address.

  • _aClose :: Event t ()

    The socket has closed. This will fire exactly once when the socket closes for any reason, including if your _acClose event fires or if the socket closes in response to a caught exception.

  • _aError :: Event t IOException

    An exception occurred. Treat the socket as closed after you see this. You will see the _aClose event fire as well, but not necessarily in the same frame.

Lenses

AcceptConfig

acClose :: forall t t. Lens (AcceptConfig t) (AcceptConfig t) (Event t ()) (Event t ()) Source #

Accept

aClose :: forall t. Lens' (Accept t) (Event t ()) Source #

aError :: forall t. Lens' (Accept t) (Event t IOException) Source #