Interface SseServer

All Superinterfaces:
AutoCloseable

public interface SseServer extends AutoCloseable
A special HTTP server whose only purpose is to provide Server-Sent Event functionality.

A Soklet application which supports Server-Sent Events will be configured with a SseServer. A regular HttpServer is only required if the same application also serves ordinary HTTP Resource Methods.

For example:

// Set up our SSE server
SseServer sseServer = SseServer.fromPort(8081);

// Wire the SSE server into our config
SokletConfig config = SokletConfig.withSseServer(sseServer)
  .build();

// Add .httpServer(HttpServer.fromPort(8080)) if you also serve ordinary HTTP resources

// Run the app
try (Soklet soklet = Soklet.fromConfig(config)) {
  soklet.start();
  System.out.println("Soklet started, press [enter] to exit");
  soklet.awaitShutdown(ShutdownTrigger.ENTER_KEY);
}

See https://www.soklet.com/docs/server-sent-events for detailed documentation.

Author:
Mark Allen