Trigger events across networks using TCP/IP sockets
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Chain Reactor

Build Status

Chain Reactor is a simple server that waits for incoming connections, then kicks off some code when one is made. Clients are locked down by IP address, so you will only recieve connections from known clients. Also, data can be passed via JSON, XML, or anything you like.

The “reactions” are written in ruby code, like this:

react_to '' do |data|
  puts "Hello,, I'm going to do something now!"
  puts data.inspect  #=> Prints a hash

It really is that easy. Also, you can respond to multiple clients with the same code block:

react_to ['',''] do |data|
  puts "Hello, I'm going to do something now!"

It can be run as a daemon, multithreaded (each client connection in a new thread), and bind to different addresses and ports.


This project started as a way of notifying other machines about builds happening on Jenkins, our continuous integration server. A chain reactor server would be sitting, listening for connections. When a build fails or passes on Jenkins, it lets the chain reactor server(s) know, pushing the build data. The chain reactor server then does what it likes, and the Jenkins server doesn't need to know.

I'm sure this has plenty of other uses, but it works great with continuous integration set-ups.


This can be installed through ruby gems:

$ gem install chain-reactor


Chain reactor comes with two command line tools, chain-reactor (the server) and chain-reactor-client (I think you can guess).

A chain file is required to run the server, as this specifies which clients to accept and what to do. Fortunately, it's easy to create a template:

$ chain-reactor template > Chainfile.rb

Open it up and edit it to your liking. You might want to test it locally first, i.e. only react to addresses. In one terminal, run:

$ chain-reactor start Chainfile.rb --ontop

The –ontop option stops it from running as a daemon, making it easier to see what's happening. By default, the chain reactor server runs on port 1987, but that's configurable if you want to change it. In another terminal, run the client with:

$ chain-reactor-client --address

Follow the instructions by adding key/value pair data to send to the server, then watch it react!

For more information on configuration, take a look at the wiki.


  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request