Interface WebSocketCreator

All Known Implementing Classes:
JakartaWebSocketCreator

public interface WebSocketCreator
Abstract WebSocket creator interface.

This can be used for filtering of the WebSocket object creation due to criteria such as origin or sub-protocol, or for choosing a specific WebSocket object based on the upgrade request.

  • Method Details

    • createWebSocket

      Object createWebSocket(ServerUpgradeRequest request, ServerUpgradeResponse response, Callback callback)
      Create a websocket from the incoming request.

      If the creator returns null it is responsible for completing the Callback and sending a response. But if the creator intends to return non-null WebSocket object, it MUST NOT write content to the response or complete the Callback, but it may modify the response headers.

      Parameters:
      request - the request details
      response - the response details
      callback - the callback, should only be completed by the creator if a null WebSocket object is returned.
      Returns:
      the WebSocket object, or null to take responsibility to send error response if no WebSocket is to be created.