Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
html5-websocket
Advanced tools
Readme
:warning: 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.
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.
npm install --save html5-websocket
The API is the same as the standard HTML5 Socket API so nothing new here...
const WebSocket = require('html5-websocket');
const ws = new WebSocket('ws://html5rocks.websocket.org/echo');
ws.onopen = function () {
ws.send('Hello!');
};
ws.onmessage = function (e) {
console.log(e.data);
};
ws.onerror = function (error) {
console.log('Fail:', error);
};
You can also use the DOM Level 2 Event Model
const handleMessage = function (e) {
console.log(e.data);
};
// add listener
ws.addEventListener('message', handleMessage);
// remove listener
ws.removeEventListener('message', handleMessage);
MIT
FAQs
HTML5 WebSocket for node.js
The npm package html5-websocket receives a total of 255 weekly downloads. As such, html5-websocket popularity was classified as not popular.
We found that html5-websocket demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.