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: DurationThe duration of time between server-initiated WebSocket heartbeats.
Defaults to 30 seconds.
heartbeat_timeout: DurationThe minimum amount of time between client heartbeats before a connection is dropped.
Defaults to 5 minutes.
port: u32The port to run the server on. Defaults to 8080.
ip: StringThe IP to listen on. Defaults to 0.0.0.0.
Implementations
pub fn serve(
self,
service_factory: impl JamsocketServiceFactory<ServiceActorContext>
) -> Result<()>
pub fn serve(
self,
service_factory: impl JamsocketServiceFactory<ServiceActorContext>
) -> Result<()>
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 inexplicitroom creation mode./ws/{room_id}(GET): initiate a WebSocket connection to the given room. If the room does not exist and the server is inimplicitroom creation mode, it will be created.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Server
impl UnwindSafe for Server
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
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