Interface WsHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface WsHandler
Handler for WebSocket upgrade requests. Called when a client sends an HTTP request with "Upgrade: websocket". The handler receives the original HTTP request and an open WebSocket connection.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(HttpRequest request, WsConnection connection)
    Handle a WebSocket connection after the upgrade handshake completes.
  • Method Details

    • accept

      void accept(HttpRequest request, WsConnection connection)
      Handle a WebSocket connection after the upgrade handshake completes. This method is called on a Netty worker thread. Implementations should register message callbacks on the connection and return promptly.
      Parameters:
      request - the HTTP request that initiated the WebSocket upgrade
      connection - the WebSocket connection for sending and receiving messages