websockets-0.12.7.3: A sensible and clean way to write WebSocket-capable servers in Haskell.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.WebSockets.Client

Description

This part of the library provides you with utilities to create WebSockets clients (in addition to servers).

Synopsis

Documentation

type ClientApp a = Connection -> IO a Source #

A client application interacting with a single server. Once this IO action finished, the underlying socket is closed automatically.

runClient Source #

Arguments

:: String

Host

-> Int

Port

-> String

Path

-> ClientApp a

Client application

-> IO a 

runClientWith Source #

Arguments

:: String

Host

-> Int

Port

-> String

Path

-> ConnectionOptions

Options

-> Headers

Custom headers to send

-> ClientApp a

Client application

-> IO a 

runClientWithSocket Source #

Arguments

:: Socket

Socket

-> String

Host

-> String

Path

-> ConnectionOptions

Options

-> Headers

Custom headers to send

-> ClientApp a

Client application

-> IO a 

runClientWithStream Source #

Arguments

:: Stream

Stream

-> String

Host

-> String

Path

-> ConnectionOptions

Connection options

-> Headers

Custom headers to send

-> ClientApp a

Client application

-> IO a 

newClientConnection Source #

Arguments

:: Stream

Stream that will be used by the new Connection.

-> String

Host

-> String

Path

-> ConnectionOptions

Connection options

-> Headers

Custom headers to send

-> IO Connection 

Build a new Connection from the client's point of view.

WARNING: Be sure to call close on the given Stream after you are done using the Connection in order to properly close the communication channel. runClientWithStream handles this for you, prefer to use it when possible.

Low level functionality

data Protocol Source #

Constructors

Hybi13 

Instances

Instances details
Show Protocol Source # 
Instance details

Defined in Network.WebSockets.Protocol

checkServerResponse :: Stream -> RequestHead -> IO () Source #

Check the response from the server. Throws OtherHandshakeException on failure

streamToClientConnection :: Stream -> ConnectionOptions -> IO Connection Source #

Build a Connection from a pre-established stream with already finished handshake.

NB: this will not perform any handshaking.