Client Options
Options are passed to the client at two stages:
WebsocketClient
constructoropen
method
using SimpleWebsockets
client = WebsocketClient([; clientOptions...])
# ...
open(client, url[, customHeaders::Dict{String, String}; socketOptions...])
clientOptions
Overrides the default clientConfig
SimpleWebsockets.clientConfig
— ConstantThe default options for WebsocketClient
0x100000::Integer
1MiB
The maximum frame size that the client will accept
8 * 0x100000::Integer
8MiB
The maximum assembled message size that the client will accept
true::Bool
Outgoing frames are fragmented if they exceed the set threshold.
16 * 0x0400::Integer
16KiB
Outgoing frames are fragmented if they exceed this threshold.
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.
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.
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.
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
This setting only has an affect as of Julia 1.3
false::Bool
Use Array{UInt8, 1} instead of String as messaging format.
socketOptions
Options to pass into the underlying HTTP.request
Handy options:
::Bool
Set to false
to work with snakeoil certs. Handy for testing.
::Int
Set to 0, 1 or 2.
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.defaultHeaders
— ConstantdefaultHeaders::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
)