
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
promise-ws
Advanced tools
A promise based WebSocket implementation for Node.js. Built on top of ws
import WebSocket from "promise-ws";
(async function() {
const ws = await WebSocket.create("ws://www.host.com/path");
ws.on("message", function incoming(data) {
console.log(data);
});
await ws.send("something");
})();
import WebSocket from "promise-ws";
(async function() {
const wss = await WebSocket.Server.create({ port: 8080 });
wss.on("connection", async function connection(ws) {
ws.on("message", function incoming(message) {
console.log("received: %s", message);
});
await ws.send("something");
});
})();
$ npm install promise-ws
promise-ws
API is almost the same with ws except that:
websocket.ping([data[, mask]])
returns a promisewebsocket.pong([data[, mask]])
returns a promisewebsocket.send(data[, options])
returns a promiseWebSocket.Server.create(options)
, returns a promise of listened WebSocket.Server
instanceWebSocket.create(options)
, returns a promise of opened WebSocket
instanceFor more WebSocket API, please checkout the API doc.
MIT
FAQs
A Promise-Based WebSocket implementation for Node.js
The npm package promise-ws receives a total of 5,107 weekly downloads. As such, promise-ws popularity was classified as popular.
We found that promise-ws 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.