Class SessionDispatcher
java.lang.Object
org.simpleframework.http.socket.service.SessionDispatcher
The
SessionDispatcher
object is used to perform the
opening handshake for a WebSocket session. Once the session has been
established it is connected to a Service
where frames
can be sent and received. If for any reason the handshake fails
this will terminated the connection with a HTTP 400 response.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SessionBuilder
This is used to create the session for the WebSocket.private final Router
This is used to select the service to dispatch to. -
Constructor Summary
ConstructorsConstructorDescriptionSessionDispatcher
(SessionBuilder builder, Router router) Constructor for theSessionDispatcher
object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is used to create a dispatch aSession
to a specific service selected by a router.void
This method is used to terminate the connection and commit the response.
-
Field Details
-
builder
This is used to create the session for the WebSocket. -
router
This is used to select the service to dispatch to.
-
-
Constructor Details
-
SessionDispatcher
Constructor for theSessionDispatcher
object. The dispatcher created will dispatch WebSocket sessions to a service using the providedRouter
instance.- Parameters:
builder
- this is used to build the WebSocket sessionrouter
- this is used to select the service
-
-
Method Details
-
dispatch
This method is used to create a dispatch aSession
to a specific service selected by a router. If the session initiating handshake fails for any reason this will close the underlying TCP connection and send a HTTP 400 response back to the client.- Parameters:
request
- this is the session initiating requestresponse
- this is the session initiating response
-
terminate
This method is used to terminate the connection and commit the response. Terminating the session before it has been dispatched is done when there is a protocol or an unexpected I/O error with the underlying TCP channel.- Parameters:
request
- this is the session initiating requestresponse
- this is the session initiating response
-