Struct jamsocket_server::Server[][src]

pub struct Server {
    pub heartbeat_interval: Duration,
    pub heartbeat_timeout: Duration,
    pub port: u32,
    pub ip: String,
}
Expand description

Settings used by the server.

Fields

heartbeat_interval: Duration

The duration of time between server-initiated WebSocket heartbeats.

Defaults to 30 seconds.

heartbeat_timeout: Duration

The minimum amount of time between client heartbeats before a connection is dropped.

Defaults to 5 minutes.

port: u32

The port to run the server on. Defaults to 8080.

ip: String

The IP to listen on. Defaults to 0.0.0.0.

Implementations

Start a server given a [JamsocketService].

This function blocks until the server is terminated. While it is running, the following endpoints are available:

  • / (GET): return HTTP 200 if the server is running (useful as a baseline status check)
  • /new_room (POST): create a new room, if not in explicit room creation mode.
  • /ws/{room_id} (GET): initiate a WebSocket connection to the given room. If the room does not exist and the server is in implicit room creation mode, it will be created.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more