Skip to content

Instantly share code, notes, and snippets.

@trappist
Created September 1, 2017 01:51
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 trappist/18f41932732c5546069a8e5f21972585 to your computer and use it in GitHub Desktop.
Save trappist/18f41932732c5546069a8e5f21972585 to your computer and use it in GitHub Desktop.
def subscribe_to_ticker
@ticker_thread = Thread.new do
@ticker_connection = WampClient::Connection.new(uri: 'wss://api.poloniex.com', realm: 'realm1', verbose: false)
@ticker_connection.on_join do |session, details|
session.subscribe('ticker', method(:ticker_handler))
end
@ticker_connection.on_disconnect do |reason|
puts "DISCONNECTED: #{reason}"
end
@ticker_connection.open
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment