Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

outbreak

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

outbreak

Service process management with dnode rpc

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

Outbreak

Service process management with dnode rpc

Strider Build Status Dependency Status devDependency Status Gittip

NPM

Overview

The outbreak module makes it easy to break a monolithic program out to one or more spawned processes, and then either continue communicating with them actively or simply exit and allow control to be picked up again the next time your program runs (or even by another program).

See the examples/ directory to see how outbreak can be used.

Implementing a server

To implement a service process using outbreak, simply create a new instance of outbreak.Server and call it's connect() method.

The constructor expects a configuration map with two options: name (a unique identifier), and remoteMethods, which exposes any methods you want outbreak clients to be able to call.

outbreak = require 'outbreak'
server = new outbreak.Server
  name: 'simple'
    remoteMethods:
      getString: (cb) -> cb 'foo'

When connect() is called, a pidfile and a socket will be created (using the name option that was passed to the constructor). When your service catches SIGINT, these files will be unlinked and the process will exit.

You can also use publish data with events to all connected clients.

setInterval ->
  n = Math.floor(Math.random() * 100)
  server.publish 'data', n
, 1000

server.connect()

License

Copyright (c) 2014-2015 Logan Koester Licensed under the MIT license.

FAQs

Package last updated on 25 Apr 2015

Did you know?

Socket

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.

Install

Related posts