Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Keep your network connections alive in node.js no matter what.
Recon looks like a regular tcp connection but it listens for disconnect events
and tries to re-establish the connection behind the scenes. While the connection
is down, write()
returns false
and the data gets buffered. When the
connection comes back up, recon emits a drain
event.
var recon = require('recon');
var conn = recon(4321);
conn.on('data', function (buf) {
var msg = buf.toString().trim()
console.log(msg);
});
then fire up stayin_alive.js: $ node stayin_alive.js
and then you can listen on port 4321 with netcat, type some stuff, kill netcat, and fire it up again to type some more stuff: $ nc -lp 4321 nc: using stream socket everybody stop ^C $ nc -lp 4321 nc: using stream socket hammertime ^C
and meanwhile stayin_alive.js didn't skip a beat: $ node stayin_alive.js everybody stop hammertime
Create a connection. The arguments can be specified in kwargs
or wherever in
arguments list and are optional except port. cb
is a function that gets the
raw Stream
object each time a new connection happens for tacking on methods
like .setNoDelay()
.
Like stream.write
, but buffers data while the module is reconnecting.
Terminate the connection (and don't reconnect).
Just like stream.
Emitted only the first time the connection is established.
Emitted each time the module establishes a connection after the first time.
Just like stream, unless err.errno
is 111 (ECONNREFUSED), in which case the
error gets eaten and recon reconnects behind the scenes.
FAQs
Keep a network connection alive by reconnecting repeatedly
The npm package recon receives a total of 7 weekly downloads. As such, recon popularity was classified as not popular.
We found that recon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.