hatchet.io-server

Hatchet.io server implementation

npm install hatchet.io-server
10 downloads in the last week
10 downloads in the last month

Hatchet Server

Hatchet is a server and set of client libraries that you can setup beside you app infrastructure to add realtime interactions to your app. It is a homebrew version of services such as PubNub or Pusher. Currently there is the server code (this package), NPM module for the frontend Js, and Objective C code.

Straight up Hatchet is nothing without Socket.IO by Guillermo Rauch, Learnboost and Githubians. It is the library of code that Hatchet just wraps around - Socket.IO is the magic in the act.

Hathcet was built by Ben Pearson (@benjaminpearson) of Inlight Media.

Usage

Install the NodeJS NPM Module:

npm install hatchet.io-server
  • Copy bin/publisher.js and bin/subscriber and configure them for your environment.
  • Use rest.js as a starting point for the server that will send the messages and manage the channels.
  • Start all 3 processes and send the relevant POST commands using curl.

Create a channel:

curl -v -H "Content-Type: application/json" -X POST -d '{ "channel": "demo", "email": "hello@email.me" }' http://localhost:8039/create

Server response:

{
  "status": true,
  "results": {
    "channel": "demo",
    "api": {
      "token": "eqpKlYigv1x4YG0Isxd9iJmYHJRKnn3hWQQtqu6PY2AVyL",
      "email": "hello@email.me"
    },
    "tokens": {
      "publishers": "0b0xTFs4YoWiARqx3MrQnJnQR33hkjEYPGXnmVKBNSgLYTLw",
      "subscribers": "LlNhGgPconcAmBnxR4ncvXbFntYt1SwiU4lioYeZnTCGAdZ"
    }
  }
}

Send a message:

curl -v -H "Content-Type: application/json" -X POST -d '{ "auth": { "channel": "demo", "secret": "0b0xTFs4YoWiARqx3MrQnJnQR33hkjEYPGXnmVKBNSgLYTLw" }, "data": { "event": "next", "data": { "line": 100, "file": "test.js" } }}' http://localhost:8039/message

To receive a message, implement a hatchet.io client using javascript or objective-c. More details on how to that are on the hatchet.io GitHub page.

License

Copyright (c) 2013 Ben Pearson Licensed under the MIT license.

npm loves you