DEPRECATED
⚠️ Consider this library as deprecated. It was created to expose ws
with a WebSocket
interface. This is no longer needed because latest versions of ws
already implement this interface.
html5-websocket
This module implements the standard HTML5 WebSocket API as a thin layer over the great ws library.
The motivation behind this module is to be able to write WebSocket based libraries that will run without changes in Node.js, Browsers or React Native apps.
Install
npm install --save html5-websocket
Usage
The API is the same as the standard HTML5 Socket API so nothing new here...
const WebSocket = ; const ws = 'ws://html5rocks.websocket.org/echo'; ws { ws;}; ws { console;}; ws { console;};
You can also use the DOM Level 2 Event Model
const handleMessage = { console;}; // add listenerws; // remove listenerws;
License
MIT