An app with the latest stable Node.js engine, express.js, and server-sent events.
- Open multiple consoles and run the below command,
curl -H Accept:text/event-stream http://localhost:3000/events
- All these requests are waiting for any input to be sent from the server.
-
To start the docker container, run the below command
docker-compose down; docker rmi $(docker images -f "dangling=true" -q); docker system prune; docker-compose up --build -d; docker-compose ps -
To stop the docker container, run
docker-compose down
- open a single tab and run the below command,
curl -X POST \ -H "Content-Type: application/json" \ -d '{"info": "Some info", "source": "Some source"}'\ -s http://localhost:3000/facts
- Make sure the above subscribers are ready and listening.
- Upon firing the above command, the other subscriber console will get this data.
- To get the no. of clients connected to the server, use the below command,
curl -X GET http://localhost:3000/status
- To get the facts sent to the server, use below command,
curl -X GET http://localhost:3000/facts