Struct tk_http::websocket::Config [] [src]

pub struct Config { /* fields omitted */ }

Configuration of a websocket::Loop object (a server-side websocket connection).

Methods

impl Config
[src]

[src]

Create a config with defaults

[src]

Set ping interval

Default is 10 seconds.

If no messages have been received within this interval, we send a ping message. Only full messages are accounted. If some large frame is being received for this long, we still send ping.

Note: you can't remove the interval, but you can set it to a sufficiently large value.

Note 2: you may also need to tune inactivity timeout if you change this value.

[src]

Set inactivity timeout

Default is 25 seconds.

A connection is shut down if no messages were received during this interval.

Note: only full frames are accounted. If some very large frame is being sent too long, we drop the connection. So be sure to set this value large enough so that slowest client can send largest frame and another ping.

There are two use cases for this interval:

  1. Make it 2.5x the ping_interval to detect connections which don't have destination host alive

  2. Inactivity interval that is smaller than ping_interval will detect connections which are alive but do not send any messages. This is similar to how HTTP servers shutdown inactive connections.

Note: you may also need to tune ping interval if you change this value.

[src]

Sets both message timeout and byte timeout to the same value

[src]

Similar to message timeout but works at byte level

Being less strict timeout this value is two-way: any byte sent or received resets the timer (Also, we do our best to ignore outgoing pings)

There are two points to consider for tweaking timeout:

  1. To prevent resource exhaustion by a peer: sending a byte at a time, you might make it higher, up to message timeout
  2. To be able to receive larger messages (say 1Mb or 10 Mb) you can make message timeout much larger for largest message to fit, but make byte timeout smaller so that if nothing it being received you can close connection earlier.

Note: there is no sense to make this value larger than message_timeout

[src]

Maximum packet size

If some frame declares size larger than this, we immediately abort the connection

[src]

Create a Arc'd config clone to pass to the constructor

This is just a convenience method.

Trait Implementations

impl Debug for Config
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for Config
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Config

impl Sync for Config