
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
Lightweight WebSocket client & server wrapper with reconnects, events, acks, and dev tools.
A lightweight JavaScript utility for WebSocket-based client-server communication with:
once
)Initialize a new Node.js project:
npm init -y
npm install socked
Or clone this repo and use the files in src/
.
If installed from npm:
For Node.js (server):
import { createServer } from 'socked';
For Browser (with a bundler):
import { createClient } from 'socked';
If using in the browser without a bundler (via CDN):
<script type="module">
import { createClient } from 'https://cdn.jsdelivr.net/npm/socked/+esm';
// ...your code...
</script>
Create the file: examples/server.js
import { createServer } from '../src/server.js';
const wss = createServer({ port: 3000 });
wss.onClient((client) => {
console.log('Client connected');
client.onEvent('join', (data) => {
console.log('Join:', data);
client.emit('welcome', { message: `Welcome to ${data.room}` });
});
});
Run the server:
node examples/server.js
Create the file: examples/client.html
<!DOCTYPE html>
<html>
<head>
<title>socked Client</title>
</head>
<body>
<h1>socked Client</h1>
<script type="module">
import { createClient } from '../src/client.js';
const socket = createClient('ws://localhost:3000', {
reconnect: true
});
socket.on('connect', () => {
console.log('Connected to server');
socket.emit('join', { room: 'main' });
});
socket.on('welcome', (data) => {
console.log('Server says:', data.message);
document.body.innerHTML += `<p>${data.message}</p>`;
});
socket.on('disconnect', () => {
console.log('Disconnected. Will retry...');
});
</script>
</body>
</html>
Open the file in your browser (e.g., with Live Server in VS Code).
Client:
socket.emitWithAck('saveData', { name: 'Test' })
.then(response => console.log('✅ Ack:', response))
.catch(err => console.error('❌ Timeout or Error:', err));
Server:
client.onEvent('saveData', (data) => {
console.log('Saving data:', data);
client.emit(`saveData_ack_${data._ackId}`, { success: true });
});
socket.once('config', (cfg) => {
console.log('Loaded config:', cfg);
});
Handled internally: the server sends pings and expects pong responses to keep the connection alive.
console.log('Connection Status:', socket.getStatus()); // "connected" or "disconnected"
socket.off('eventName'); // remove all listeners for that event
See src/client.js and src/server.js for full API details.
MIT
Contributions welcome!
Create an issue or open a PR on GitHub.
FAQs
Lightweight WebSocket client & server wrapper with reconnects, events, acks, and dev tools.
The npm package socked receives a total of 9 weekly downloads. As such, socked popularity was classified as not popular.
We found that socked demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.