Class ServerSentEventService

java.lang.Object
io.mangoo.services.ServerSentEventService

public class ServerSentEventService extends Object
Author:
svenkubiak
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addConnection(io.undertow.server.handlers.sse.ServerSentEventConnection connection)
    Adds a new connection to the manager
    void
    Closes all connections for a given URI resource
    Set<io.undertow.server.handlers.sse.ServerSentEventConnection>
    Retrieves all connection resources under a given URL
    void
    Removes all URI resources for a given URL
    void
    send(String uri, String data)
    Sends data to all connections for a given URI resource
    void
    send(String uri, String data, io.undertow.server.handlers.sse.ServerSentEventConnection.EventCallback eventCallback)
    Sends data to all connections for a given URI and invokes the callback on Success or failure
    void
    setConnections(String uri, Set<io.undertow.server.handlers.sse.ServerSentEventConnection> uriConnections)
    Sets the URI resources for a given URL

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • addConnection

      public void addConnection(io.undertow.server.handlers.sse.ServerSentEventConnection connection)
      Adds a new connection to the manager
      Parameters:
      connection - The connection to put
    • send

      public void send(String uri, String data)
      Sends data to all connections for a given URI resource
      Parameters:
      uri - The URI resource for the connection
      data - The event data
    • send

      public void send(String uri, String data, io.undertow.server.handlers.sse.ServerSentEventConnection.EventCallback eventCallback)
      Sends data to all connections for a given URI and invokes the callback on Success or failure
      Parameters:
      uri - The URI resource for the connection
      data - The event data
      eventCallback - A callback that is notified on Success or failure
    • close

      public void close(String uri)
      Closes all connections for a given URI resource
      Parameters:
      uri - The URI resource for the connection
    • getConnections

      public Set<io.undertow.server.handlers.sse.ServerSentEventConnection> getConnections(String uri)
      Retrieves all connection resources under a given URL
      Parameters:
      uri - The URI resource for the connections
      Returns:
      A Set of connections for the URI resource
    • setConnections

      public void setConnections(String uri, Set<io.undertow.server.handlers.sse.ServerSentEventConnection> uriConnections)
      Sets the URI resources for a given URL
      Parameters:
      uri - The URI resource for the connection
      uriConnections - The connections for the URI resource
    • removeConnections

      public void removeConnections(String uri)
      Removes all URI resources for a given URL
      Parameters:
      uri - The URI resource for the connection