libwebem — WebSocket Example

Two WebSocket endpoints are running. The Echo endpoint reflects messages back unchanged. The PubSub endpoint demonstrates two server-push patterns: a per-client ticker thread (ticker topic) and a broadcast to all subscribers (announce topic).

Echo — ws://localhost:8080/ws/echo disconnected

Sends back exactly what you type. No subscription logic.

PubSub — ws://localhost:8080/ws/pubsub disconnected

ticker — the server pushes an incrementing count to this connection every 2 s (per-handler background thread).
announce — messages published by any client are broadcast to all connected clients subscribed to this topic via cWebem::ForEachHandler(). The server also sends a periodic announcement every 15 s from its own background thread.