Class WebsocketHandler

java.lang.Object
io.undertow.server.handlers.PathHandler
ortus.boxlang.web.handlers.WebsocketHandler
All Implemented Interfaces:
io.undertow.server.HttpHandler

public class WebsocketHandler extends io.undertow.server.handlers.PathHandler
The WebsocketHandler is a handler that handles WebSocket connections. Based on Undertow.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WebsocketHandler(io.undertow.server.HttpHandler next, String prefixPath)
    Create a new WebsocketHandler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Broadcast a message to all open connections.
    Set<io.undertow.websockets.core.WebSocketChannel>
    Get all connections
    void
    sendMessage(io.undertow.websockets.core.WebSocketChannel channel, String message)
    Send a message to a WebSocket channel.

    Methods inherited from class io.undertow.server.handlers.PathHandler

    addExactPath, addPath, addPrefixPath, clearPaths, handleRequest, removeExactPath, removePath, removePrefixPath, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WebsocketHandler

      public WebsocketHandler(io.undertow.server.HttpHandler next, String prefixPath)
      Create a new WebsocketHandler.
      Parameters:
      next - The next handler in the chain
      prefixPath - The prefix path
  • Method Details

    • getConnections

      public Set<io.undertow.websockets.core.WebSocketChannel> getConnections()
      Get all connections
    • sendMessage

      public void sendMessage(io.undertow.websockets.core.WebSocketChannel channel, String message)
      Send a message to a WebSocket channel.
      Parameters:
      channel - The WebSocket channel
      message - The message to send
    • broadcastMessage

      public void broadcastMessage(String message)
      Broadcast a message to all open connections.
      Parameters:
      message - The message to broadcast