Serve every connection on a host and port, as it comes.
Modulevortex-ws-0.2.1GHC2024
Vortex.Ws
The websocket mouth of a vortex. Each connection becomes one Session whose frames are text messages; identity is Anonymous, since a websocket carries no credential the transport could check: a host authenticates in band, or binds the mouth to a trusted network.
serveWs takes every connection as it comes. serveWsWith and serveWsOn hold a connection to WsLimits (a deadline for the handshake, a cap on a message and on a frame, no compression) and to a test of its request head, so a host can refuse what it never serves, such as a browser's cross-site request, before a Session exists.
- 1 type
- 5 values
- Packagevortex-ws-0.2.1
- Exports6
- LanguageGHC2024
- LicenceBSD-3-Clause
- SourceWs.hs
What one connection may cost before it is a Session.
Constructors
WsLimitswsHandshakeSeconds :: IntHow long a client has to complete its handshake.
wsMessageBytes :: Int64The largest message a client may send, whole; a larger one ends the connection, as the end of the stream.
wsFrameBytes :: Int64The largest single frame a client may send.
wsPingSeconds :: IntHow often the server pings, to keep an idle connection alive through a proxy.
Ten seconds to shake hands, a 64 KiB message and frame, and a ping every thirty seconds.
Serve on a host and port, holding each connection to the limits and refusing one whose request head the test refuses.
Serve on a socket already listening: a TCP one, or a unix one a service manager or the host made, for a proxy in front to reach. A connection that does not finish its handshake in time, or whose head the test refuses, is closed without a Session; a refused head is answered 403.
A connection as a Session: text frames in and out, binary frames for a duplex call, the end of the stream when the peer goes.