简体   繁体   English

python-socketio与Gevent-socketio

[英]python-socketio vs Gevent-socketio

I am choosing a python library to write a live-chat function page embed in my website. 我正在选择一个python库来编写嵌入在我的网站中的实时聊天功能页面。

I found two libraries that based on Socket.IO, python-socketio and gevent-socketio : 我发现了两个基于Socket.IO的库, python-socketiogevent-socketio

From python-socketio doc : python-socketio doc

Python implementation of the Socket.IO realtime server. Socket.IO实时服务器的Python实现。

From gevent-socketio doc : gevent-socketio doc

Socket.IO is a WebSocket-like abstraction that enables real-time communication between a browser and a server. Socket.IO是类似于WebSocket的抽象,可实现浏览器和服务器之间的实时通信。 gevent-socketio is a Python implementation of the protocol. gevent-socketio是该协议的Python实现。

You see, both are implementation of Socket.IO. 您会看到,它们都是Socket.IO的实现。

I want to choose one of them(or if there is a better library than them I don't know). 我想选择其中之一(或者是否有比我不知道的更好的库)。

My consideration points are bellow: 我的考虑要点是:

  1. My python backend project is written by Django/Django-Rest-Framework framework. 我的python后端项目是由Django / Django-Rest-Framework框架编写的。

  2. My project is in a hurry, I want to use a more convenient lib, write less code to realize my requirement. 我的项目很着急,我想使用更方便的lib,编写更少的代码来实现我的要求。

I surfed the internet, the gevent-socketio live-chat must use the gevent python WSGI server, I am not sure whether this is a limit for my project deployment. 我上网冲浪, gevent-socketio实时聊天必须使用gevent python WSGI服务器,我不确定这是否限制了我的项目部署。

Who can give me the suggestion to choose the best library for me? 谁能给我建议为我选择最佳图书馆?

Sorry to answer this question so late. 很抱歉这么晚回答这个问题。 I am the author and maintainer of python-socketio, so I'm going to give you a biased response. 我是python-socketio的作者和维护者,所以我将给您以偏颇的答复。

The gevent-socketio project hasn't been maintained in a while. gevent-socketio项目已经有一段时间没有得到维护了。 As of today, the most current commit on the repository on GitHub is from September 2016, which is about 2.5 years ago. 截至今天, GitHub存储库上的最新提交是从2016年9月开始的,大约是2.5年前。 The version of the Socket.IO protocol supported by this package is the 0.x releases, which are old and totally incompatible with the Socket.IO 1.x and 2.x releases. 此软件包支持的Socket.IO协议版本为0.x版本,该版本较旧并且与Socket.IO 1.x和2.x版本完全不兼容。

My python-socketio project was born as a result of the slowing down in the development of gevent-socketio, and in particular due to never receiving an upgrade to support the 1.x release of the Socket.IO protocol. 我的python-socketio项目诞生是由于gevent-socketio的开发速度减慢,尤其是由于从未收到支持Socket.IO协议1.x版本的升级。 Unlike my competitor, I decided to not add a hard dependency on gevent. 与竞争对手不同,我决定不对gevent添加严格的依赖。 Instead, I have a plugin system that allowed me to support many different web server frameworks. 相反,我有一个插件系统,该系统使我能够支持许多不同的Web服务器框架。 As of today, the support extends to eventlet, gevent, uwsgi (combined with gevent), asyncio (combined with aiohttp, sanic or any ASGI complaint server) and Tornado. 到目前为止,支持范围已扩展到eventlet,gevent,uwsgi(与gevent结合),asyncio(与aiohttp,sanic或任何ASGI投诉服务器结合)和Tornado。 This package supports all the 1.x and 2.x releases of the Socket.IO protocol, and I make sure it can connect to the official JavaScript clients, which is what most people use with it. 该软件包支持Socket.IO协议的所有1.x和2.x版本,并且我确定它可以连接到官方的JavaScript客户端,这是大多数人使用的客户端。 In case it is useful, a Python based Socket.IO client is also included. 如果有用,还包括基于Python的Socket.IO客户端。

Hope this helps! 希望这可以帮助!

You should checkout gevent-websocket as well. 您还应该签出gevent-websocket I use it everyday with my projects, works great. 我每天在项目中都使用它,效果很好。

https://github.com/jgelens/gevent-websocket/tree/master/geventwebsocket https://github.com/jgelens/gevent-websocket/tree/master/geventwebsocket

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

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