Package io.muserver
Interface MuWebSocketFactory
-
public interface MuWebSocketFactory
A factory that can convert an upgrade request into a web socket.
This is registed with the
WebSocketHandlerBuilder.withWebSocketFactory(MuWebSocketFactory)
method.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MuWebSocket
create(MuRequest request, Headers responseHeaders)
Creates a web socket for an upgrade request.
-
-
-
Method Detail
-
create
MuWebSocket create(MuRequest request, Headers responseHeaders) throws java.lang.Exception
Creates a web socket for an upgrade request.- Parameters:
request
- An upgrade request.responseHeaders
- Any headers added to this object will be returned with the upgrade response.- Returns:
- A web socket, or null if no websocket should be created (in which case the next handler in the chain will be called).
- Throws:
java.lang.Exception
- Any thrown exceptions will result in errors being returned to the client. Note that exceptions such asClientErrorException
can be used in order to control the HTTP response codes.
-
-