Project

sarb

0.0
No commit activity in last 3 years
No release in over 3 years
Framework for em-websocket that uses actions and triggers for real-time communication with your app.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.5.0
 Project Readme

Socket Action Ruby (sarb)

Framework for em-websocket that uses actions and triggers for real-time communication with your app.

Install

For latest rubygems version:

gem "sarb"

For latest github commit:

gem "sarb", :git => "https://github.com/craigjackson/sarb.git"

Example

require "sarb"

app = Sarb::Application.new
app.action(:foo) { |session, args| session.message(:action => :bar) }
app.run

On client side:

var ws = new WebSocket("ws://127.0.0.1:8080/");
ws.onmessage = function(message) { console.log(message) };
ws.send(JSON.stringify({ action: "foo" }))

Linked Examples

License

The MIT License - Copyright (c) 2012-2013 Craig Jackson