ericchapman / ruby_wamp_client

WAMP Client for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Poloniex wamp error on connect

brauliobo opened this issue · comments

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

https://poloniex.com/support/api/

Hey @brauliobo. What's your code for connecting? The abort came from the server stating that auto-activation is not yet implemented. I need to see your actual code.

This is working fine for me

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_challenge do |authmethod, extra|
    puts 'challenged'
  end

  connection.on_disconnect do |reason|
    puts 'disconnected'
    puts reason
  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

hmm, I was using ticker as realm instead of realm1. Just changing that made it work. It isn't clear to me, but is it always realm1 to be used?

thanks @ericchapman for your help and your code!

No problem @brauliobo. "realm1" is the default realm in WAMP routers. Some people change it, some don't. "ticker" is the "topic" to subscribe to.

commented

Hello. I'm trying to test your code and for me it stops after:

TX: SUBSCRIBE > [32, 8855332363434436, {}, "ticker"]
RX: SUBSCRIBED > [33, 8855332363434436, 3426281876427369]

it's only my problem?

@MoroZvlg is this the same router as in this thread? It looks like the subscription is happening properly but no one on the router is actually publishing to topics.

commented

Yes. I tested the same code as you post here.

If i understand correctly(from this issue: dutu/poloniex-api-node#15) they stoped support WAMP protocol and now using simple websocket at wss://api2.poloniex.com endpoint.