Class WSCommServer

All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable, CommServer

public class WSCommServer extends AbstractCommServer
WebSocket-based implementation of CommServer, providing the basic wiring to map gwt-rpc websocket messages to fishlib Commands and back again. Nearly any case where a CommServer is expected, this class should suffice, with only a very few differences:
  • Since there is no fishlib port, getPort throws an exception - getHttpPort should be used instead
  • handleCommand is currently unimplemented, to avoid the risk of being sent a non-websocket ClientEntry
  • sendCommandWithResponse and sendAsyncCommandWithResponse are not yet implemented
  • Constructor Details

    • WSCommServer

      public WSCommServer(com.fishlib.configuration.Configuration configuration, String name, com.fishlib.io.logger.Logger log, RpcSocketFactory clientFactoryFunction, int port, @Nullable @Nullable Function<org.eclipse.jetty.ee10.servlet.ServletContextHandler,org.eclipse.jetty.server.Handler> contextConsumer, String commPath, Supplier<? extends WebSocketServer.WebsocketMarker> commServerEndpointFactory)
  • Method Details

    • getKeyStorePath

      public static String getKeyStorePath(com.fishlib.configuration.Configuration configuration)
      Get the keystore path.
      Parameters:
      configuration - the Configuration instance to use
      Returns:
      the keystore path
    • getKeystorePassphrase

      public static String getKeystorePassphrase(com.fishlib.configuration.Configuration configuration)
      Get the passphrase.
      Parameters:
      configuration - the Configuration instance to use
      Returns:
      the passphrase
    • getPort

      public int getPort()
    • getHttpPort

      public int getHttpPort()
    • sendAsyncCommandWithResponse

      public void sendAsyncCommandWithResponse(ClientEntry client, String serviceId, com.fishlib.base.Command cmd, AsyncCommandHandler handler, long timeoutMillis, boolean allowFlush)
    • sendCommandWithResponse

      public com.fishlib.base.Command sendCommandWithResponse(ClientEntry client, String serviceId, com.fishlib.base.Command command, AsyncCommandHandler handler, long timeoutMillis, boolean allowFlush)
    • disconnect

      public void disconnect() throws IOException
      Specified by:
      disconnect in interface CommServer
      Overrides:
      disconnect in class AbstractCommServer
      Throws:
      IOException
    • handleCommand

      public void handleCommand(ClientEntry client, com.fishlib.base.Command cmd)
    • append

      public com.fishlib.base.log.LogOutput append(com.fishlib.base.log.LogOutput logOutput)