How to mock websocket endpoints
You can also be interested in:
Have you ever need to mock some sort of websocket endpoint during the early stage of development of an application? I do. I could easily mock REST apis with json-server, but then I had to wrote something allowing me to mock sokects also.
The result is ws-server-ftw (ws-server was taken on npm, uh). Let's start with a screencast...
Basically, ws-server-ftw provides a way to easily mock websocket endpoints, serving a json file or a js file exporting an object. Using the js format you can randomize things, ws-server-ftw reloads the input database before any send action, so random stuff get updated!
Pressing Enter in the cli let's you send the data again, so in order to send different data you can just edit the db file and then hit Enter, or you can use some commands that the cli provide: merge, deepmerge, append and custom data.
All this stuff is explained in detail in the repository page, so I'll not repeat it here.
At the moment incoming messages are just printed to the console, maybe in the future I'll add more features though. As always collaboration and PR are welcome!
Let me know what do you think about it! Cheers.
Your Smartwatch Loves Tasker!
Your Smartwatch Loves Tasker!
Featured
Archive
- 2021
- 2020
- 2019
- 2018
- 2017
- Nov
- Oct
- Aug
- Jun
- Mar
- Feb
- 2016
- Oct
- Jun
- May
- Apr
- Mar
- Feb
- Jan
- 2015
- Nov
- Oct
- Aug
- Apr
- Mar
- Feb
- Jan
- 2014
- Sep
- Jul
- May
- Apr
- Mar
- Feb
- Jan
- 2013
- Nov
- Oct
- Sep
- Aug
- Jul
- Jun
- May
- Apr
- Mar
- Feb
- Jan
- 2012
- Dec
- Nov
- Oct
- Aug
- Jul
- Jun
- May
- Apr
- Jan
- 2011
- Dec
- Nov
- Oct
- Sep
- Aug
- Jul
- Jun
- May