Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
fastify-ws
Advanced tools
Basic WebSocket support for Fastify built on the blazing fast ws and uws libraries.
WebSocket support for Fastify built on the blazing fast ws and uws libraries.
In server.js
:
'use strict'
const fastify = require('fastify')()
fastify.register(require('fastify-ws'), {
library: 'uws' // Use the uws library instead of the default ws library
})
fastify.ready(err => {
if (err) throw err
fastify.ws
.on('connection', socket => {
socket.on('message', msg => socket.send(msg)) // Creates an echo server
})
})
fastify.listen(34567)
Then run node server.js
and navigate to http://localhost:34567
in your browser. In the browser's JavaScript console, open a client-side WebSocket connection:
const host = location.origin.replace(/^http/, 'ws')
const ws = new WebSocket(host)
ws.onmessage = msg => console.log(msg.data)
Then, still in the browser console, send some messages to the server and watch as they're echoed back to you:
ws.send('WebSockets are awesome!')
// => undefined
// LOG: WebSockets are awesome!
If you choose to use uws
as your WebSocket library, ensure that you have configured your system properly and understand that the API is a slightly reduced subset of ws
's.
Licensed under MIT.
FAQs
Basic WebSocket support for Fastify built on the ws and uws libraries.
The npm package fastify-ws receives a total of 217 weekly downloads. As such, fastify-ws popularity was classified as not popular.
We found that fastify-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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.