ipc-bus
v0.0.7arrow_drop_downv0.0.7
v0.0.6
v0.0.5
v0.0.4
v0.0.1
STATUS
None
DOWNLOADS
429
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
N/A
No fuss, minimal ipc client/server-like communication.1
1 contributor
Like
Install ipc-bus as a package?
Copied
npm i @bit/bit.utils.ipc-bus
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example modifieddraft
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
No preview available
chevron_left
chevron_right
ipc-bus
No fuss, minimal ipc client/server-like communication.
Usage
// server.js
const {
listenToMessage,
stopListening
} = require('@bit/bit.utils.ipc-bus')('foo')
listenToMessage(async message => {
// do something with message here
// an ack will be sent to the client
// when this function resolves
})
process.on('SIGINT', stopListening)
// client.js
const { sendMessage } = require('@bit/bit.utils.ipc-bus')('foo')
async function main () {
try {
await sendMessage('foo')
console.log('message received')
} catch (e) {
if (e === 'Server not found') {
console.log('Please start server.js first')
} else {
console.error(e)
}
}
}
main()