ericchapman / ruby_wamp_client Goto Github PK
View Code? Open in Web Editor NEWWAMP Client for Ruby
License: MIT License
WAMP Client for Ruby
License: MIT License
connect
TX: HELLO > [1, "ticker", {:roles=>{:caller=>{:features=>{:caller_identification=>true, :call_timeout=>true, :call_canceling=>true, :progressive_call_results=>true}}, :callee=>{:features=>{:caller_identification=>true, :pattern_based_registration=>true, :shared_registration=>true, :call_canceling=>true, :progressive_call_results=>true, :registration_revocation=>true}}, :publisher=>{:features=>{:publisher_identification=>true, :subscriber_blackwhite_listing=>true, :publisher_exclusion=>true}}, :subscriber=>{:features=>{:publisher_identification=>true, :pattern_based_subscription=>true, :subscription_revocation=>true}}}, :agent=>"Ruby-WampClient-0.0.7"}]
RX: ABORT > [3, {:message=>"internal error: realm auto-activation not yet implemented"}, "wamp.error.not_authorized"]
Attempting Reconnect... Next attempt in 8 seconds
The code for additional fields is skipping kwargs if args is 'nil' or 'empty'. See below
return payload if (self.arguments.nil? or self.arguments.empty?)
payload.push(self.arguments)
return payload if (self.argumentskw.nil? or self.argumentskw.empty?)
payload.push(self.argumentskw)
I've noticed that nothing happens on a connection.open
call when jruby is being used. Is there any reason why jruby isn't supported?
Hi Eric,
I was trying to integrate this gem into my rails app, the gem works fine indepently but when i load rails environemnt along with the script, i get disconnected just after connecting and verbose:true also dosen't print logs.
Script that works:
require 'wamp_client'
wsuri = 'wss://api.poloniex.com'
options = {
uri: wsuri,
realm: 'realm1',
}
connection = WampClient::Connection.new(options)
connection.on_connect do
puts 'connection established'
end
connection.on_join do |session, details|
puts 'session created'
def got_ticker(args, kwargs, details)
puts args
puts kwargs
puts details
end
session.subscribe('ticker', method(:got_ticker))
end
connection.open
Rake task that does not work:
task :poloniex => :environment do
wsuri = 'wss://api.poloniex.com'
options = {
uri: wsuri,
realm: 'realm1',
verbose: true
}
connection = WampClient::Connection.new(options)
connection.on_connect do
puts 'connection established'
end
connection.on_join do |session, details|
puts 'session created'
def got_ticker(args, kwargs, details)
puts args
puts kwargs
puts details
end
session.subscribe('ticker', method(:got_ticker))
end
connection.open
end
I tried loading the environment manually as well, which also dosen't work:
require File.expand_path('../../config/environment', __FILE__)
require 'wamp_client'
wsuri = 'wss://api.poloniex.com'
options = {
uri: wsuri,
realm: 'realm1',
}
connection = WampClient::Connection.new(options)
connection.on_connect do
puts 'connection established'
end
connection.on_join do |session, details|
puts 'session created'
def got_ticker(args, kwargs, details)
puts args
puts kwargs
puts details
end
session.subscribe('ticker', method(:got_ticker))
end
connection.open
Output that i get from the scripts that do not work:
connection established
Attempting Reconnect... Next attempt in 2 seconds
connection established
Attempting Reconnect... Next attempt in 4 seconds
``
In recent ruby environment, I can't use ruby_wamp_client.
ps. I think not to need push request like tiny feature.
require 'wamp_client'
wsuri = 'wss://api2.poloniex.com:443/'
options = {
uri: wsuri,
realm: 'realm1',
headers: {Upgrade: 'websocket',
Connection: 'Upgrade',}
}
connection = WampClient::Connection.new(options)
connection.on_connect do
puts 'connection established'
end
connection.on_challenge do |authmethod, extra|
puts 'challenged'
end
connection.on_disconnect do |reason|
puts 'disconnected'
end
connection.on_leave do |reason, details|
puts 'session terminted'
end
connection.on_join do |session, details|
puts 'session created'
def got_ticker(args, kwargs, details)
puts args
puts kwargs
puts details
end
session.subscribe('ticker', method(:got_ticker))
end
connection.open
I am trying to connect to a secured socket using this library, it gets connected, but the session never gets made(on_join is never called), the api seems to be working fine with autobahn javascript.
ERROR: Error installing wamp_client:
ERROR: Failed to build gem native extension.
current directory: /home/kiju/.gem/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/usr/bin/ruby24 -r ./siteconf20161228-16135-vibso9.rb extconf.rb
creating Makefile
current directory: /home/kiju/.gem/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /home/kiju/.gem/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
} else if (klass == rb_cFixnum) {
^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
} else if (klass == rb_cBignum) {
^
Makefile:241: polecenia dla obiektu 'generator.o' nie powiodły się
make: *** [generator.o] Błąd 1
make failed, exit code 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.