
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
tcp-log-server
Advanced tools
Serve an append-only log over TCP.
npm install --global tcp-log-server
tcp-log-server
The server uses pino logging. To improve console log output:
npm install --global pino
tcp-log-server | tee server.log | pino
Configure tcp-log-server
with environment variables:
PORT
for TCPBLOBS
directory for entry JSON files, named by hash, or memory
to
store in memoryLEVELDB
directory for LevelDB data files, or memory
to store in
memoryThe package exports a factory function. Given a pino log, a
LevelUP instance, an abstract-blob-store, and an EventEmitter
,
it returns a TCP connection handler function suitable for
net.createServer(handler)
. Any LevelDOWN and abstract-blob-store
will do. Store log entires or blobs in memory, in a remote store,
or in whatever combination you like.
There is one caveat: The storage back-end for the LevelUP must support snapshots. level-party and a few other helper packages prevent snapshotting.
The server accepts TCP connections. It enables keep-alive on each socket. All messages are newline-delimited JSON objects. tcp-log-client provides a high-level interface.
Clients can send:
{"from":1}
On receipt, the server will begin sending log entries with indices
greater than or equal to from
. (The first index is 1
.) Each entry
will be sent like:
{"index":"1","entry":{"some":"entry"}}
Servers may report errors reading specific log entries:
{"index":45,"error":"some-error"}
When the server has sent all entries in the log as of the time the read message was received, it will send:
{"current":true}
{"id":"some-id","entry":{"arbitrary":"data"}}
require('uuid').v4()
, with the uuid package, is an easy way to
generate id strings.
Once successfully appended to the log, the server will confirm the index of the newly appended entry.
{"id":"some-id","index":44}
If there is an error, the server will instead respond:
{"id":"some-id-string","error":"error-string"}
FAQs
serve an append-only log over TCP
The npm package tcp-log-server receives a total of 39 weekly downloads. As such, tcp-log-server popularity was classified as not popular.
We found that tcp-log-server 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.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.