This project contains a simple HTTP server that allows to test client applications that needs to consume WebSocket.
For the current version you can customize it through 2 environment variables :
- $MOCK_MESSAGE : define the message that the server will send to the client over WebSocket protocol it has a default value of "Default Message from Go Websocket Mock"
- $MESSAGE_INTERVAL : define the interval (in seconds) that the server will send to the client. its default value is 5 seconds
You can easily build the dockerfile and run it. It will expose the port 8085
First build the image :
docker build -t jossefaz/web-socket-mock .
Then run it
docker run -p 8089:8085 jossefaz/web-socket-mock:latest
If you want to customize the interval and the message
docker run -p 8089:8085 --env MESSAGE_INTERVAL=2 --MOCK_MESSAGE=[{"test": "ok"}] jossefaz/web-socket-mock:latest