有没有办法将stdout
推送到队列代理或 websocket?
到目前为止,我无法找到有关如何执行此操作的明确解释。
我有几个进程并行运行,这个想法是创建一个 UI,您可以在其中从一个进程切换到另一个进程并查看它们在做什么。
一种有效的方法(并且是非阻塞的,可以为多个客户端提供服务)是使用 Python、Twisted 和 Autobahn:
连接一个或多个进程协议实例
- http://twistedmatrix.com/documents/current/core/howto/process.html
到扭曲的 WebSocket 服务器
- https://github.com/tavendo/AutobahnPython
- https://github.com/tavendo/AutobahnPython/tree/master/examples/websocket/broadcast
- https://github.com/tavendo/AutobahnPython/tree/master/examples/wamp/pubsub/simple
披露:我是Autobahn的作者。