go get -u github.com/baxiry/im
create a websocket on browser and send message as json :
to subscribe to a topic (channel) send :
{
"event":"subscribe",
"channel":"my-channel-id"
}event must be : subscribe, unsubscribe, message,
Later we will add events: reseive, andseen,
to send message to channel/topic:
{
"event" : "message",
"channel" : "my-channel-123",
"data" : "hi frends"
}then all client subscribe with "my-channel-123" will be receive "hi frinds" message.
Just create a channel and share it between two clients only, this is how you create a private connection
- websocket
- Pubsub
- cache message
- 100% Unit testing
Use this library with whatever license you prefer.