
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@bit-js/bun-ws
Advanced tools
bun-ws
A simple WebSocket router for Bun.
Route file:
import { route } from '@bit-js/bun-ws';
export default route<{ id: string }>({
message(ws) {
ws.send(ws.data.id);
}
});
Use with a fetch handler.
import route from './route';
export default function fetch(req: Request) {
route.upgrade(req, {
data: { id: performance.now().toString() }
});
}
Entry point:
import fetch from './fetch';
import { serve } from '@bit-js/bun-ws';
// Create a server and bind all registered routes to that server
const server = serve({
// Bun server options
server: { fetch },
// WebSocket base handler options (without handlers)
ws: { publishToSelf: true }
});
Use bind
if you already have a server instance not created using serve
:
import { bind } from '@bit-js/bun-ws';
// Bind all registered routes to a server
bind(server);
FAQs
A simple WebSocket router for Bun.
We found that @bit-js/bun-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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.