Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
TCP version of IPCEE
This is a TCP wrapper that has the same api as IPCEE. It's a low level API to interact with a socket by using send()
and an event listener.
Wait, why isn't IPC sufficient?
Well, in some cases, you want your child process to be independent. IPC requires a link between master and child to be established. If your master dies, your child dies too. Sure, you could set detached: true
and the child won't die, but communications won't be possible through IPC because the link has been broken.
As this is a low level library, you have to handle the server/socket connections. For a higher level api, consider relieve-failsafe.
const Server = require('net').Server
const TCPEE = require('tcpee')
//Init the tcpee with null, the socket isn't connected yet
const tcpee = new TCPEE(null)
//it's possible to send data, which will be stored until the client is available
tcpee.send('take this', 'when you are online')
tcpee.on('start', function() {
console.log('the child has started')
})
const server = new Server()
server.listen('tcpee.sock')
server.on('connection', function(sock) {
//Because we've init the TCPEE module before, we need to set up things manually
tcpee.client = sock
//Hook events here, socket is writable
tcpee._hookEvents()
//Or just create the TCPEE here:
let client = new TCPEE(sock)
})
const Socket = require('net').Socket
const socket = new Socket({allowHalfOpen: true})
const TCPEE = require('tcpee')
let client = new TCPEE(socket)
socket.connect('tcpee.sock')
socket.on('connect', function() {
client.send('start')
})
client.on('take this', function(data) {
console.log(data) //outputs: when you are online
})
// you should always send back the error
process.on('uncaughtException', function(err) {
client.send('error', err.toString(), err.stack)
process.nextTick(e => process.exit(1))
})
// required to keep the same behavior as IPCEE in case of exit
process.on('exit', function(code) {
client.send('$TCPEE_EXIT', code)
process.nextTick(e => process.exit(code))
})
/**
* Constructor
* @param socket - the socket to write/read to/from
* @param options - eventemitter2 options
*/
new TCPEE(socket = null, {wildcard: true})
/**
* @param key - the key you'll listen on
* @param ...args
*/
tcpee.send('key', arg1, arg2)
/**
* @param key
* @param ...args data received
*/
tcpee.on('key', function(arg1, arg2) {
})
Apart from the send
method, the api inherits the one of EventEmitter2.
The MIT License (MIT)
Copyright (c) 2015 Antoine Bluchet
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
TCP version of IPCEE
The npm package tcpee receives a total of 1 weekly downloads. As such, tcpee popularity was classified as not popular.
We found that tcpee 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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.