
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
boomerang-socket
Advanced tools
Boomerang Socket is a small JavaScript library that extends the native WebSocket API to allow automatic reconnection if a client is disconnected.
npm install boomerang-socket
npm run test
It can be used in exactly the same way as a native WebSocket, with exactly the same API.
// ES2015
import BoomerangSocket from "boomerang-socket";
// Or CommonJS
const BoomerangSocket = require("boomerang-socket");
const socket = new BoomerangSocket("wss://localhost:5000");
socket.addEventListener("open", (event) => {
socket.send("Hello server!");
});
socket.onmessage = (event) => {
console.log("Message from server: ", event.data);
};
The only difference is that the BoomerangSocket
constructor accepts an additional third argument: an options config object which customises the auto-reconnect behaviour.
const socket = new BoomerangSocket("wss://localhost:8080", undefined, {
reconnectAttempts: 25,
reconnectDelay: 5000,
});
name | type | default | description |
---|---|---|---|
connectTimeout | number | 250 | millisecond timeout before a new connection must return open |
reconnect | boolean | true | enables or disables auto-reconnection |
reconnectAttempts | number | Infinity | maximum number of reconnection attempts |
reconnectDelay | number | 3000 | millisecond delay until first reconnection attempt |
reconnectDelayExponent | number | 1.05 | exponent applied to reconnectDelay between each reconnection attempt |
We actively welcome any contributions. You can open a Pull Request here.
FAQs
A simple WebSocket wrapper with automatic reconnection
The npm package boomerang-socket receives a total of 0 weekly downloads. As such, boomerang-socket popularity was classified as not popular.
We found that boomerang-socket 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
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.