New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

telegraph

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telegraph

A framework which acts as an interface between Socket.IO and Express.

  • 0.8.22
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
36
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Telegraph

Telegraph aims to combine Express with Socket.IO to into a reactor pattern style web framework for quickly building event heavy projects.

Get started:

npm install telegraph -g
telegraph init
npm install -d

telegraph start
// Current defaults for Telegraph
module.exports = App = new Telegraph.Server({
     'appname'        : "Telegraph",   // For aesthetic purposes, the name of the application
     'websockets'     : true,          // Enables websocket events via socket.io
     'view engine'    : 'ejs'          // The templating engine used to render views
});

Starting the Server:

telegraph start

or use foreman

foreman start

Configuration

Configure the express server like so:

App.use("middleware-name", { settings });
App.use(middlewarename, { settings });

App.set("setting", "value");

Routes

Follow traditional express routing

App.get("/", function(req,res) {
     res.render("index");
});

App.post("/article/create", function(req,res) {
     res.send("it worked!");
});
  
App.destroy("/article/destroy/:id", function(req, res) {
     res.send("it worked!");
});

Websocket Events

App.on("websocket:foo", function(data) { 
     App.send("message", data);      // for standard socket.io "emit" events"
     App.volley("message", data);    // for volatile socket.io "emit" events"
     App.broadcast("message", data);    // for broadcast socket.io "emit" events"
});

Using Databases

By default, Telegraph uses loose wrappers around Backbone Models and Collections as a temporary datastore. CouchDB can be configured in the /config/database.json file:

{
    "development" : {

        "adapter"      : "couch",
        "host"         : "hostname",
        "dbname"       : "database name",
        "port"         : port,

        "auth"         : {
            "username" : "username",
            "password" : "password"
        }
    } 
}

This will setup cradle for the above settings at App.db.


Heroku Hosting:

Telegraph is already configured for Heroku Cedar Stack. After running a telegraph init, do the following:

heroku create --stack cedar
git push heroku master

FAQs

Package last updated on 06 Feb 2012

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc