
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
Bidirectional rpc and streams for WebSockets and WebRTC.
basic
const methodman = require('methodman')
const fs = require('fs')
const meth = methodman(duplexStream)
meth.commands({echo: (txt, cb) => cb(null, txt), ping: cb => cb(null)})
meth.on('commands', remote => {
if (remote.ping) {
let start = Date.now()
remote.ping(() => {
console.log(`pingtime ${Date.now() - start}`)
})
}
})
fs.createReadStream('test.file').pipe(meth.stream('test.file'))
meth.on('stream', (stream, id) {
stream.pipe(fs.createWriteStream(`${__dirname}/${id}`))
})
client.js
const websocket = require('websocket-stream')
const methodman = require('methodman')
const ws = websocket('ws://localhost:8080')
const meth = methodman(ws)
meth.commands({echo: (txt, cb) => cb(null, txt), ping: cb => cb(null)})
meth.on('commands', remote => {
// call remote commands
})
let substream = meth.stream()
// now i can take someStream and .pipe(substream)
meth.on('stream', (stream, id) => {
// I'm being sent a stream.
})
server.js
const websocket = require('websocket-stream')
const methodman = require('methodman')
function onWebsocketStream (stream) {
var meth = methodman(stream)
meth.commands({echo: (txt, cb) => cb(null, txt), ping: cb => cb(null)})
meth.on('commands', remote => {
// call remote commands
})
let substream = meth.stream()
// now i can take someStream and .pipe(substream)
meth.on('stream', (stream, id) => {
// I'm being sent a stream.
})
}
const wss = websocket.createServer({server: app}, onWebsocketStream)
const SimplePeer = require('simple-peer')
methodman(stream)Takes a duplex stream to sit on top of.
Returns a MethodMan instance.
meth.stream([id])Returns a new writable substream.
meth.commands(rpc)Expose a set of commands defined in the rpc object.
Uses dnode under the hood.
A set of commands you can call that have been exposed by the other end.
A set of commands you can call that have been exposed by the other end.
A readable stream being sent from the remote end.
A readable stream being sent from the remote end.
FAQs
Bidirectional rpc and streams for WebSockets and WebRTC.
We found that methodman 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.