Package net.carcdr.yhocuspocus.websocket
Class WebSocketServer.Builder
java.lang.Object
net.carcdr.yhocuspocus.websocket.WebSocketServer.Builder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the WebSocketServer instance.Sets the host/interface to bind to.Sets the WebSocket path.pingInterval(Duration pingInterval) Sets the WebSocket ping interval for keepalive.port(int port) Sets the port to listen on.server(net.carcdr.yhocuspocus.core.YHocuspocus hocuspocus) Sets the YHocuspocus server instance.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
server
Sets the YHocuspocus server instance.- Parameters:
hocuspocus- the server (required)- Returns:
- this builder
-
port
Sets the port to listen on.- Parameters:
port- port number (0 = random port, default: 1234)- Returns:
- this builder
-
host
Sets the host/interface to bind to.- Parameters:
host- hostname or IP (null = all interfaces)- Returns:
- this builder
-
path
Sets the WebSocket path.- Parameters:
path- the path (default: "/")- Returns:
- this builder
-
pingInterval
Sets the WebSocket ping interval for keepalive.The server will automatically send WebSocket ping frames at this interval to detect broken connections. Set to
Duration.ZEROto disable automatic pings.- Parameters:
pingInterval- the ping interval (default: 30 seconds)- Returns:
- this builder
-
build
Builds the WebSocketServer instance.- Returns:
- new WebSocketServer
- Throws:
IllegalStateException- if required fields are missing
-