Interface WebSocketFilter

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 WebSocketFilter
Security filter to decide if an incoming web socket connection is acceptable. Sample:
apiGateway.setWebSocketFilter(req -> {
        return req.getPath().equals("chat");
});
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onClose(Set<String> paths)
    Invokes when a WebSocket Endpoint closes.
    io.datatree.Promise
    Decides whether to accept the incoming WebSocket request or close the connection.
  • Method Details

    • onConnect

      io.datatree.Promise onConnect(WebRequest request)
      Decides whether to accept the incoming WebSocket request or close the connection.
      Parameters:
      request - incoming WebSocket connection
      Returns:
      true = accept connection, false = close socket
    • onClose

      default void onClose(Set<String> paths)
      Invokes when a WebSocket Endpoint closes.
      Parameters:
      paths - Paths (relative URLs) of closed WebSocket Endpoints