Interface WebSocketCreator


public interface WebSocketCreator

Allows to create (custom) WebSocket endpoints instances given the HTTP request and HTTP response.

  • Method Details

    • createWebSocket

      Object createWebSocket(ServerUpgradeRequest upgradeRequest, ServerUpgradeResponse upgradeResponse, Callback callback) throws Exception

      Creates a WebSocket endpoint instance from the incoming request.

      If the implementation does not want to create a WebSocket endpoint instance, it is responsible to send a response (and completing the callback) and then it may return null.

      If the implementation returns a non-null WebSocket endpoint instance, it must not write response content, nor completing the callback, but it may modify the response headers.

      Parameters:
      upgradeRequest - the upgrade request
      upgradeResponse - the upgrade response
      callback - the callback to complete only when returning null
      Returns:
      a WebSocket endpoint instance, or null if no WebSocket endpoint instance should be created for the given upgrade request
      Throws:
      Exception - if the WebSocket endpoint instance creation fails