Skip to content

This repository hold a mock server written in Go that send user defined message at defined interval

Notifications You must be signed in to change notification settings

jossefaz/go-websocket-mock-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebSocket Mock Server

Purpose


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

Install


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 

About

This repository hold a mock server written in Go that send user defined message at defined interval

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published