Pregunta

I have a Python Autobahn WAMP server (v. 0.8.8, app code at http://pastebin.com/DfQvaJYF) working fine with a Python client. Using latest Twisted 13.2. for both server and client.

However, the browser javascript client (autobahn js from CDN, app code at http://pastebin.com/1GGaRP5e) similarly taken from Autobahn JS examples subscribes to a topic, but does not receive any messages. There are no errors whatsoever anywhere. Same happens when running the client using Node.js.

Checking the server log, I can see that nothing is indeed transmitted - there are no TX WAMP EVENTs ever, after the js web or the Node.js client connects and subscribes.

The WAMP server is running on port 8080, and the JS web client page is served from port 8111. Both on the same host.

¿Fue útil?

Solución

Found the issue. Thank you @oberstet for commenting (see above). While just setting the client realm to suggested default realm1 did not work, that lead me towards the solution.

The short and simple answer is that the Python WAMP server should always explicitly set the realm. This applies at least when the server implements a component that subclasses wamp.ApplicationSession (many or all the examples at the autobahn website).

In other words, in the server there has to be an onConnect function that joins a realm. Without it,

  • a similarly constructed Python client (that does not join a realm), will work
  • no (Python or Javascript) client that sets a realm will work

Some speculation beyond the solution: If one can build a Javascript client that works without setting a realm (example I used requires explicit realm), perhaps such a client would work as well. Perhaps the Python WAMP server code is buggy in its setting of default realm. Or maybe it's just that the default has been changed. I don't know.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top