
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.
simple-message-channels
Advanced tools
Simple streamable state machine that implements a useful channel, message-type, message pattern
Simple streamable state machine that implements a useful channel, message-type, message pattern
npm install simple-message-channels
const SMC = require('simple-message-channels')
const a = new SMC({
onmessage (channel, type, message) {
console.log('Received a message on channel', channel) // a number
console.log('Message type is', type) // a number
console.log('And the message payload was', message) // a buffer
}
})
const b = new SMC()
// produce a payload
const payload = b.send(0, 1, Buffer.from('hi'))
// somehow send it to the other instance (over a stream etc)
// can arrive chunked as long as it arrives in order
a.recv(payload)
(This is the basic wire protocol used by hypercore, https://github.com/mafintosh/hypercore)
payloadBuffer = smc.send(channel, type, message)Encode a channel, type, message to be sent to another person. Channel can be any number and type can be any 4 bit number. Message should be a buffer.
success = smc.recv(payloadChunk)Parse a payload buffer chunk. Once a full message has been parsed
the smc.onmessage(channel, type, message) handler is called.
Returns true if the chunk seemed valid and false if not.
If false is returned check smc.error to see the error it hit.
payloadBuffer = smc.sendBatch([{ channel, type, message }, ...])Encodes a series of messages into a single paylaod buffer.
MIT
FAQs
Simple streamable state machine that implements a useful channel, message-type, message pattern
We found that simple-message-channels 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.