Calling publish from outside a custom Autobahn WampClientProtocol

陌路散爱 提交于 2019-12-11 11:34:04

问题


How do I call an autobahn/wamp/twisted protocol publish method from outside of the protocol class?

I have a custom python autobahn client based on https://github.com/tavendo/AutobahnPython/blob/master/examples/wamp/pubsub/custom/client.py. I am attempting to publish an event from outside of the custom WampClientProtocol class and am having trouble. If I assign the protcol object to a variable, line 1387 of wamp.py (https://github.com/tavendo/AutobahnPython/blob/master/autobahn/autobahn/wamp.py) fails with exception "MyClientProtocol instance has no attribute factory". If I try and call the factory (i.e. "factory.protocol.publish(msg)"), I get the error that the publish method is unbound.


回答1:


Just in case someone stumbles upon this question: solutions were discussed on the Autobahn mailing list and working code can be found here: https://github.com/oberstet/scratchbox/tree/master/python/gephi



来源:https://stackoverflow.com/questions/15163550/calling-publish-from-outside-a-custom-autobahn-wampclientprotocol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!