Class WebsocketFactory

java.lang.Object
de.iip_ecosphere.platform.support.websocket.WebsocketFactory

public abstract class WebsocketFactory extends Object
Generic access to WebSockets. Requires an implementing plugin of type WebsocketFactory or an active WebsocketFactoryProviderDescriptor. Simplified interface akin to WebSocket.
Author:
Holger Eichelberger, SSE
  • Field Details

  • Constructor Details

    • WebsocketFactory

      public WebsocketFactory()
  • Method Details

    • getInstance

      public static WebsocketFactory getInstance()
      Returns the WebServices instance.
      Returns:
      the instance
    • setInstance

      public static void setInstance(WebsocketFactory rest)
      Manually sets the instance. Shall not be needed, but may be required in some tests.
      Parameters:
      rest - the Rest instance
    • createSocket

      public abstract WebsocketFactory.WebSocket createSocket(URI uri) throws IOException
      Creates the websocket.
      Parameters:
      uri - the URI to connect to
      Returns:
      the socket instance
      Throws:
      IOException - if creating fails
    • createBroadcastingServer

      public abstract de.iip_ecosphere.platform.support.Server createBroadcastingServer(de.iip_ecosphere.platform.support.ServerAddress address) throws IOException
      Creates a broadcasting/relay server.
      Parameters:
      address - the server address
      Returns:
      the socket instance
      Throws:
      IOException - if creating fails