Echo Client
Echo Client is a client-side JS library to test WebSocket with Echo Messages.
Installation
Manual Download
Download the echo.js file and add it to your project folder. Download here
Using NPM
Use the package manager npm to install Echo Client.
npm install echo-client
You need to use Express Server to serve the file. Add this line to your Express Server.
app;
Next add it to your HTML.
Usage
//Create a Echo providing the WebSocket Echo Server URL//This one is good - "wss://echo.websocket.org"let echo = "wss://echo.websocket.org"; //Set the Callback to execute when receiving a message from the server. echo; //generate(callback, n)//This method send n messages with the callback that generate an object as content to Echo Server//You will receive the same messages.// IMPORTANT: The Callback must return an Object!echo; //generateEverySecond(callback, second, n)//This method send n messages with the callback that generate an object as content to Echo Server//and repeat this every setted second/s.echo; //Stop the generateEverySecond method if loop is running.echo;
Version 1.0.0 - Under Construction
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
ISC