简体   繁体   English

从外部调用Autobahn WampClientProtocol调用发布

[英]Calling publish from outside a custom Autobahn WampClientProtocol

How do I call an autobahn/wamp/twisted protocol publish method from outside of the protocol class? 如何从协议类外部调用高速公路/ wamp / twisted协议发布方法?

I have a custom python autobahn client based on https://github.com/tavendo/AutobahnPython/blob/master/examples/wamp/pubsub/custom/client.py . 我有一个基于https://github.com/tavendo/AutobahnPython/blob/master/examples/wamp/pubsub/custom/client.py的自定义python高速公路客户端。 I am attempting to publish an event from outside of the custom WampClientProtocol class and am having trouble. 我试图从自定义WampClientProtocol类之外发布一个事件,但我遇到了麻烦。 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". 如果我将protcol对象分配给变量,wamp.py( https://github.com/tavendo/AutobahnPython/blob/master/autobahn/autobahn/wamp.py )的第1387行将失败,但“MyClientProtocol实例没有属性”厂”。 If I try and call the factory (ie "factory.protocol.publish(msg)"), I get the error that the publish method is unbound. 如果我尝试调用工厂(即“factory.protocol.publish(msg)”),我会收到发布方法未绑定的错误。

万一有人偶然发现了这个问题:在Autobahn邮件列表上讨论了解决方案,工作代码可以在这里找到: https//github.com/oberstet/scratchbox/tree/master/python/gephi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM