Skip to content

Instantly share code, notes, and snippets.

@rich
Forked from tibbon/gist:5474518
Created April 29, 2013 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rich/5485299 to your computer and use it in GitHub Desktop.
Save rich/5485299 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'socketIO'
client = SocketIO.connect("https://socketio.mtgox.com/mtgox") do
before_start do |f|
on_disconnect { p "disconnected"}
on_connect { emit("connect", nil); p "connected" }
on_heartbeat { p "."}
on_message { |msg| p msg }
on_json_message { |json| p json}
on_ack { p "ack"}
on_error { |data| p data }
on_noop { p "noop"}
end
on_event("message") do |e|
p e
end
after_start do
emit("op: subscribe", "channel: dbf1dee9-4f2e-4a08-8cb7-748919a71b21")
emit("op: subscribe", "channel: d5f06780-30a8-4a48-a2f8-7ed181b4a13f")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment