Struct ic_websocket_cdk::types::WsInitParams
source · pub struct WsInitParams {
pub handlers: WsHandlers,
pub max_number_of_returned_messages: usize,
pub send_ack_interval_ms: u64,
}
Expand description
Parameters for the IC WebSocket CDK initialization. For default parameters and simpler initialization, use WsInitParams::new
.
Fields§
§handlers: WsHandlers
The callback handlers for the WebSocket.
max_number_of_returned_messages: usize
The maximum number of messages to be returned in a polling iteration.
Defaults to 50
.
send_ack_interval_ms: u64
The interval at which to send an acknowledgement message to the client, so that the client knows that all the messages it sent have been received by the canister (in milliseconds).
Must be greater than [CLIENT_KEEP_ALIVE_TIMEOUT_MS
] (1 minute).
Defaults to 300_000
(5 minutes).
Implementations§
source§impl WsInitParams
impl WsInitParams
sourcepub fn new(handlers: WsHandlers) -> Self
pub fn new(handlers: WsHandlers) -> Self
Creates a new instance of WsInitParams, with default interval values.
pub fn with_max_number_of_returned_messages( self, max_number_of_returned_messages: usize ) -> Self
sourcepub fn with_send_ack_interval_ms(self, send_ack_interval_ms: u64) -> Self
pub fn with_send_ack_interval_ms(self, send_ack_interval_ms: u64) -> Self
Sets the interval (in milliseconds) at which to send an acknowledgement message to the connected clients.
Must be greater than [CLIENT_KEEP_ALIVE_TIMEOUT_MS
] (1 minute).
§Traps
If send_ack_interval_ms
<= [CLIENT_KEEP_ALIVE_TIMEOUT_MS
]. See WsInitParams::check_validity.
Trait Implementations§
source§impl Clone for WsInitParams
impl Clone for WsInitParams
source§fn clone(&self) -> WsInitParams
fn clone(&self) -> WsInitParams
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more