开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 0

SourceCodeSync/websockets

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
13.x
分支 (6)
标签 (41)
13.x
deprecate-legacy-implementation
main
dependabot/github_actions/pypa/cibuildwheel-2.21.1
proxy
gh-pages
13.1
13.0.1
13.0
12.0
11.0.3
11.0.2
11.0.1
11.0
10.4
10.3
10.2
10.1
10.0
9.1
9.0.2
9.0.1
9.0
8.1
8.0.2
8.0.1
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
贡献代码
同步代码
对比差异 通过 Pull Request 同步
同步更新到分支
通过 Pull Request 同步
将会在向当前分支创建一个 Pull
Request,合入后将完成同步
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause
websockets

version tests openssf

What is websockets?

websockets is a library for building Documentation is available on Read the Docs.

Here's an echo server with the asyncio API:

#!/usr/bin/env python

import asyncio
from websockets.server import serve

async def echo(websocket):
 async for message in websocket:
 await websocket.send(message)

async def main():
 async with serve(echo, "localhost", 8765):
 await asyncio.get_running_loop().create_future() # run forever

asyncio.run(main())

Here's how a client sends and receives messages with the threading API:

#!/usr/bin/env python

from websockets.sync.client import connect

def hello():
 with connect("ws://localhost:8765") as websocket:
 websocket.send("Hello world!")
 message = websocket.recv()
 print(f"Received: {message}")

hello()

Does that look good?

websockets for enterprise

Available as part of the Tidelift Subscription

The maintainers of websockets and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. let me know.)

Why should I use websockets?

The development of websockets is shaped by four principles:

  1. Correctness: websockets is heavily tested for compliance with handle backpressure correctly before the issue became widely known in the Python community.
  2. Performance: memory usage is optimized and configurable. A C extension accelerates expensive operations. It's pre-compiled for Linux, macOS and Windows and packaged in the wheel format for each system and Python version.

Documentation is a first class concern in the project. Head over to Why shouldn't I use websockets?

  • If you prefer callbacks over coroutines: websockets was created to provide the best coroutine-based API to manage WebSocket connections in Python. Pick another library for a callback-based API.

  • If you're looking for a mixed HTTP / WebSocket library: websockets aims at being an excellent implementation of RFC 7692: Compression Extensions for WebSocket. Its support for HTTP is minimal — just enough for an HTTP health check.

    If you want to do both in the same server, look at HTTP frameworks that build on top of websockets to support WebSocket connections, like What else?

    Bug reports, patches and suggestions are welcome!

    To report a security vulnerability, please use the issue or send a Contributor Covenant code of conduct.

    websockets is released under the /source-code-sync/websockets

README
BSD-3-Clause
使用 BSD-3-Clause 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/source-code-sync/websockets.git
git@gitee.com:source-code-sync/websockets.git
source-code-sync
websockets
websockets
13.x
点此查找更多帮助
评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /