Client Options

Options are passed to the client at two stages:

using SimpleWebsockets

client = WebsocketClient([; clientOptions...])
# ...
open(client, url[, customHeaders::Dict{String, String}; socketOptions...])

clientOptions

Overrides the default clientConfig

SimpleWebsockets.clientConfigConstant

The default options for WebsocketClient

maxReceivedFrameSize

0x100000::Integer 1MiB

The maximum frame size that the client will accept

maxReceivedMessageSize

8 * 0x100000::Integer 8MiB

The maximum assembled message size that the client will accept

fragmentOutgoingMessages

true::Bool

Outgoing frames are fragmented if they exceed the set threshold.

fragmentationThreshold

16 * 0x0400::Integer 16KiB

Outgoing frames are fragmented if they exceed this threshold.

closeTimeout

5::Int

The number of seconds to wait after sending a close frame for an acknowledgement to return from the server. Will force close the connection if timed out.

keepaliveTimeout

1::Union{Int, Bool}

The interval in number of seconds to solicit the server with a ping / pong response. The connection will be closed if no pong is received within the interval.

The timer is only active when no data is received from the server within the interval, ie. the server will only be pinged if inactive for a period longer than the interval.

false to disable.

Warning

Due to an underlying behaviour of HTTP, a client network disconnect will cause the connection to block in it's listen loop, only registering disconnect when the network re-connects.

keepaliveTimeout uses ping/pong and will register a disconnect in network outage events.

useNagleAlgorithm

false::Bool

The Nagle Algorithm makes more efficient use of network resources by introducing a small delay before sending small packets so that multiple messages can be batched together before going onto the wire. This however comes at the cost of latency, so the default is to disable it. If you don't need low latency and are streaming lots of small messages, you can change this to true

Julia 1.3

This setting only has an affect as of Julia 1.3

binary

false::Bool

Use Array{UInt8, 1} instead of String as messaging format.

source

socketOptions

Options to pass into the underlying HTTP.request

Handy options:

require_ssl_verification

::Bool

Set to false to work with snakeoil certs. Handy for testing.

verbose

::Int

Set to 0, 1 or 2.

Basic Authentication options

Basic authentication is detected automatically from the provided url's userinfo in the form of

scheme://user:password@host

and adds the "Authorization: Basic" header

Default request headers

SimpleWebsockets.defaultHeadersConstant
defaultHeaders::Dict{String, String}

The default headers passed to a http upgrade request

Dict{String, String}(
    "Sec-WebSocket-Version" => "13",
    "Upgrade" => "websocket",
    "Connection" => "Upgrade",
    "Sec-WebSocket-Key" => "", #new key made for every request
)
source