Sha256: 187e262ee4c2420bb12882fefa365e941edb00ff338d79905d6a796ca5a989cc
Contents?: true
Size: 825 Bytes
Versions: 5
Compression:
Stored size: 825 Bytes
Contents
class Demo require '../lib/websocket_td' def initialize client = WebsocketTD::Websocket.new('websocket.datasift.com', '/multi', 'username=zcourts&api_key=91207449dd5b89a4ff38879a770975bf') puts 'I continued' client.on_message = lambda { |message| puts "message: #{message.data}" } client.on_open = lambda { puts 'opened' client.send("{ \"action\":\"subscribe\",\"hash\":\"1f678ba99fbcad0b572011b390cf5124\"}") } client.on_close = lambda { |m| puts "Closed #{m}" } while true puts 'subscribing' if client.active client.send("{ \"action\":\"subscribe\",\"hash\":\"1f678ba99fbcad0b572011b390cf5124\"}") end sleep(1) end #if main thread finishes then the process exists...don't let that happen client.read_thread.join end end Demo.new
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
websocket-td-0.0.6 | examples/demo.rb |
websocket-td-0.0.5 | examples/demo.rb |
websocket-td-0.0.4 | examples/demo.rb |
websocket-td-0.0.3 | examples/demo.rb |
websocket-td-0.0.2 | examples/demo.rb |