sawk
v0.0.2
Published
A tiny and resilient websocket client for the browser
Readme
Sawk 
A tiny and resilient websocket client for the browser
Installation
npm install sawk --saveUsage example
Sawk provides basic utilities wrapped around the native WebSocket interface. If messages are sent before the connection is open, Sawk will queue those messages to be sent on the open event. Sawk also provides a reconnect function which when combined with the onClose handler, allows you to reconnect a closed connection.
import sawk from 'sawk';
const socket = new Sawk('wss://echo.websocket.org/')
socket.onMessage = (event) => {
};
socket.onError = (event) => {
};
socket.onClose = (event) => {
socket.reconnect();
}
socket.send('a message');
Development setup
npm install
npm test
npm buildMeta
Ryan Hinchey – @ryhinchey
Distributed under the MIT license. See LICENSE.txt for more information.
https://github.com/ryhinchey/sawk
Contributing
- Fork it (https://github.com/rhinchey/sawk/fork)
- Create your feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add a new feature') - Push to the branch (
git push origin feature/new-feature) - Create a new Pull Request
