watsy0007
V2EX  ›  Python

今天发现 1 个 io 爆表的 websocket 封装库, 大家有兴趣的可以看下.

By watsy0007 at 2020 年 2 月 10 日 · 4285 次点击

uWebSockets.py

官方给的 benchmark

perf

代码

import uws
import asyncio

# Integrate with asyncio
asyncio.set_event_loop(uws.Loop())

app = uws.App({
        "some": "option"
})

def getHandler(res, req):
	res.end("Hello Python!")

app.get("/*", getHandler)

def listenHandler():
        print("Listening to port 3000")

app.listen(3000, listenHandler)

# Run asyncio event loop
asyncio.get_event_loop().run_forever()
2 条回复  •  2020-02-11 11:04:14 +08:00
trn4
   1
trn4  
   2020 年 2 月 10 日
watsy0007
   2
watsy0007  
OP
   2020 年 2 月 11 日
@xiadong1994 github 的图片好像不能预览
推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
© 2026 V2EX · 33ms · 3.9.8.5