Class SessionBuilder

java.lang.Object
org.simpleframework.http.socket.service.SessionBuilder

class SessionBuilder extends Object
The SessionBuilder object is used to create sessions for connected WebSockets. Before the session is created a response is sent back to the connected client. If for some reason the session is not valid or does not conform to the requirements of RFC 6455 then a HTTP 400 response code is sent and the TCP channel is closed.
  • Field Details

    • scheduler

      private final Scheduler scheduler
      This is the scheduler that is used to ping WebSocket sessions.
    • reactor

      private final Reactor reactor
      This is the reactor used to register for I/O notifications.
    • ping

      private final long ping
      This is the frequency the server should send out ping frames.
  • Constructor Details

    • SessionBuilder

      public SessionBuilder(Scheduler scheduler, Reactor reactor, long ping)
      Constructor for the SessionBuilder object. This is used to create sessions using the request and response associated with the WebSocket opening handshake.
      Parameters:
      scheduler - this is the shared thread pool used for pinging
      reactor - this is used to check for I/O notifications
      ping - this is the frequency to send out ping frames
  • Method Details

    • create

      public Session create(Request request, Response response) throws Exception
      This is used to create a WebSocket session. If at any point there is an error creating the session the underlying TCP connection is closed and a Session is returned regardless.
      Parameters:
      request - this is the request associated with this session
      response - this is the response associated with this session
      Returns:
      this returns the session associated with the WebSocket
      Throws:
      Exception