The message from client to server and server to client is encrypted. Add Crypto client & server key sharing to decrypt between client and server when connected. Publish, Subscribe, Broadcast send message to subscribers but not me. Handle Unsubscribe and handle auto reconnection. Use the PubSubClient and WebSocket Client to create a WebSocket WebSocket client. Use PubSub client to send messages to subscribers and publish a message to topic abc. Use pubSub to publish messages and broadcast them to subscribers.
May limit publisher and time to send message if look like spammer
Maybe server need wait a time (short time) if detect mutiple publish messages same to one client and send a batch of messages instead of send a single message.
Add Crypto client & server key sharing to decrypt between client & server when connected. More security for WebSocket communication. The message from client to server and server to client is encrypted.
Part 1: WebSocket Client and WebSocket Server
Part 2: Subscription : Publish, Subscribe, Broadcast