是否有服务器 Python 3 websocket 模块? [英] Is there a server Python 3 websocket module?

查看:30
本文介绍了是否有服务器 Python 3 websocket 模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了几天时间试图实现一个简单的服务器来与浏览器交换消息,但它不起作用(浏览器应该是我的 Python 程序的 GUI).

I spend a few days trying to implement a simple server to exchange messages with a browser but it doesn't work(the browser is supposed to be the GUI for my python program).

我环顾四周,找不到任何可以使用的已构建模块.要么是 Python 2 的模块,要么它们太复杂了.我想要一个 .py 文件,我可以用它来读取 websocket 消息并将其发送到浏览器.

I looked around and couldn't find any already built module I can use. Either are the modules for Python 2 or else they are too complex. I want a single .py file which I can use to read and send websocket messages with/to the browser.

这样的东西存在吗?

推荐答案

它可能不符合您的简单性措施,但是 websockify 中的 websocket.py" rel="nofollow">websocket.py 文件 支持 python 2.x 和 3.x 在同一个代码库中.

It might not meet your simplicity measure, but the websocket.py file inside websockify supports python 2.x and 3.x in the same code-base.

使用它的 echo 示例 非常简单.

The echo example that uses it is pretty simple.

这篇关于是否有服务器 Python 3 websocket 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆