私はプッシュを得るために単純なwebsocketクライアントを実行するために竜巻を使用しましたが、別のファイルでtornado.queuesを処理する方法がわかりません。 プリントを使用すると、(que.get())どのようにすることができますI出力b.py <tornado.concurrent.Future object at 0x106a940b8>
外部からtornado.queuesメッセージを呼び出す方法
a.py
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado import gen
from tornado.websocket import websocket_connect
from tornado.queues import Queue
que = Queue()
class Client(object):
def __init__(self):
self.ioloop = IOLoop.instance()
self.connect()
self.ioloop.start()
@gen.coroutine
def connect(self):
ws = yield websocket_connect('ws://127.0.0.1:8001/')
while True:
msg = yield ws.read_message()
que.put(msg)
print(que.get())
if __name__ == '__main__':
Client()
b.py
import a
awe = a.que
while True:
print(awe.get())
と同様のデータを取得します。 pyデータ?
私はちょうどすぐのpythonに触れ、可能な場合は、完全なコードを投稿してください、ありがとう:)