This is a sample Websocket client to send random JSON payload to a Websockets server.
After cloning this gist, run the following commands.
npm init -y
npm i ws moment
Launch with the following command where wsUrl
is a Websockets end-point (ws:
or wss:
) and frequency is rate of publication in milli-secods.
node index.js wsUrl frequency