This is a simple chat server developed in go using NATS.
- Start the NATS service on Docker by running the following command:
docker run -d -p 4222:4222 -p 8222:8222 -p 6222:6222 --name nats-server -ti nats:latest -js - Run
go run main.go - Open any HTTP client(like Postman) and connect to the following WebSocket URL on two different tabs:
ws://localhost:8080/chat/general - Start sending messages with the following payload:
{
"text": "hello!"
}For a complete tutorial on how this works, check out my blog.