ivaylopivanov / wamp-server

WAMP Basic Profile Router
MIT License
31 stars 10 forks source link

Handle published message strange #14

Closed stanleyxu2005 closed 6 years ago

stanleyxu2005 commented 6 years ago

I use autobahn-python to subscribe a topic and then use autobahn-js to publish message to this topic. But somehow, autobahn-python doesn't understand the protocol. In concrete, in autobahn-python received message is

[36, 8483690563665722, 8483690563665722, 'testpy.echo', [], {}]

As you can see, the 4th parameter is the topic uri. But autobahn-python expects it to be some details object. like this

[36, 8483690563665722, 8483690563665722, {topic: 'testpy.echo'}, [], {}]

As you know, crossbar router has many extra features. I'm not sure whether autobahn-python only supports some very advanced message format. So I asked them link , whether my message is valid or not. They claim that their implementation follows the WAMP RPC spec. They told me their implementation is correct.

So I made some experiments on wamp-server side. In the notify method (see handler.js)

if (SESSION.getID() !== event.session.getID()) {
        DEBUG('notifying sessionID: %s', SESSION.getID());
        SESSION.send([
          outgoingChannel.EVENT,
          SESSION.getSubscriptionID(event.topic),
          event.subscription.subscriptionID,
          //event.message.incoming[3],
          {topic: event.message.incoming[3]}, // this is my work around
          event.message.incoming[4],
          event.message.incoming[5],
        ]);
      }

And then autobahn-python can receive published message successfully. Do you think this is an error of wamp-server?

stanleyxu2005 commented 6 years ago

I dont know why, in my PR, built files have different whitespace settings. If you agree with my change and want to have a more less change, please check src/handler.ts and then change code from your end. Thank you.

stanleyxu2005 commented 6 years ago

@ivaylopivanov Could you please publish the project as 0.0.7?

ivaylopivanov commented 6 years ago

Done in https://github.com/ivaylopivanov/wamp-server/commit/c687eaa8d6bc6f63cf60a69ecff5f9f5bf38098f