Interface ServerSentEventServer

All Superinterfaces:
AutoCloseable

public interface ServerSentEventServer 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 both a Server and a ServerSentEventServer.

For example:

// Set up our HTTP and SSE servers
Server server = Server.withPort(8080).build;
ServerSentEventServer sseServer = ServerSentEventServer.withPort(8081).build();

// Wire servers into our config
SokletConfig config = SokletConfig.withServer(server)
  .serverSentEventServer(sseServer)
  .build();

// Run the app
try (Soklet soklet = Soklet.withConfig(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