在crossbar高速公路上订阅python中的主题

问题描述 投票:0回答:1

我是纵横制的菜鸟。我正在尝试在python中使用高速公路和交叉开关订阅主题。

交叉链接的网址为“ wss://******.******.org/ws/”,主题为c ****** d。

没有信号通知主题,每个呼叫都将转到该主题**]。>

我在https://autobahn.readthedocs.io/en/latest/处找到了一些代码,并尝试对其进行调整。

from autobahn.twisted.component import Component
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.component import Component
from autobahn.twisted.component import run

#component with my crossbar url :

component = Component(
     transports=u"wss://******.******.org/ws/",       
     realm=u"realm1",
 )

@component.on_join
@inlineCallbacks
def joined(session,details):
    print("session ready")

    def oncounter(count):
        print("event received: {0}", count)

    try:
        yield session.subscribe(oncounter, u'c******d') #here my topic
        print("subscribed to topic")
    except Exception as e:
        print("could not subscribe to topic: {0}".format(e))

if __name__ == "__main__":
     run([component]) 

我收到此错误。似乎没有任何工作正常。

2019-10-25T14:38:07+0200 SSL error: certificate verify failed (in tls_process_server_certificate)
2019-10-25T14:38:07+0200 TLS failure: certificate verify failed
2019-10-25T14:38:07+0200 Stopping factory <autobahn.twisted.websocket.WampWebSocketClientFactory object at 0x000002B693A58>
2019-10-25T14:38:09+0200 connecting once using transport type "websocket" over endpoint "tcp"
2019-10-25T14:38:09+0200 Starting factory <autobahn.twisted.websocket.WampWebSocketClientFactory object at 0x000002B693A58>
2019-10-25T14:38:09+0200 SSL error: certificate verify failed (in tls_process_server_certificate)
2019-10-25T14:38:09+0200 TLS failure: certificate verify failed
2019-10-25T14:38:09+0200 Stopping factory <autobahn.twisted.websocket.WampWebSocketClientFactory object at 0x000002B693A58>
2019-10-25T14:38:12+0200 connecting once using transport type "websocket" over endpoint "tcp"
2019-10-25T14:38:12+0200 Starting factory <autobahn.twisted.websocket.WampWebSocketClientFactory object at 0x000002B693A58>

如前所述,我是新手,因此,对上述内容的任何见解将不胜感激!

我是纵横制的菜鸟。我正在尝试在python中使用高速公路和交叉开关订阅主题。横线网址为“ wss://******.******.org/ws/”,主题为c ****** d。没有...

python autobahn crossbar
1个回答
0
投票

我认为您想做的是:

© www.soinside.com 2019 - 2024. All rights reserved.