Skip to main content

WebSocket client with Rust backend

Project description

RWS Client (Rust WebSocket Client)

一个高性能的 WebSocket 客户端库,使用 Rust 实现核心功能,通过 PyO3 提供 Python 接口。 相较于websocket-client的python开源库,性能提升了500%以上,能够支持大批量的ws推送,不会对CPU造成特别大的负载压力。

特性

  • 高性能:核心使用 Rust 实现
  • 异步支持:完全支持 Python asyncio
  • 多连接:支持同时管理多个 WebSocket 连接
  • 事件驱动:支持 on_message、on_open、on_close 回调

安装

前置要求

如果只是作为python包使用rws client的话,那么不需要安装rust环境,直接走从pypi安装逻辑即可

  1. Python 3.11 或更高版本
  2. Rust 工具链
    # 安装 Rust
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
    # 重新加载环境变量
    source "$HOME/.cargo/env"
    
    # 验证安装
    cargo --version
    rustc --version
    

从 PyPI 安装

pip install rws-client
# 或者使用 poetry
poetry add rws-client

故障排除

如果遇到 "Cargo metadata failed" 错误,请检查:

  1. Rust 是否正确安装:

    cargo --version
    
  2. 环境变量是否正确设置:

    echo $PATH | grep cargo
    
  3. 如果没有找到 cargo,手动添加到 PATH:

    export PATH="$HOME/.cargo/bin:$PATH"
    
  4. 确保系统有必要的编译工具:

    Ubuntu/Debian:

    sudo apt-get update
    sudo apt-get install build-essential pkg-config libssl-dev
    

    CentOS/RHEL:

    sudo yum groupinstall "Development Tools"
    sudo yum install openssl-devel
    

使用示例

...(其余内容保持不变)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rws_client-0.1.4.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rws_client-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

File details

Details for the file rws_client-0.1.4.tar.gz.

File metadata

  • Download URL: rws_client-0.1.4.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.5 Linux/5.15.0-60-generic

File hashes

Hashes for rws_client-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d27a6f88c256a8a3d7ffa77abded02214899208ffc3b087b1e6cae4f03b3e5c1
MD5 e44b11533da65520edb7a73d2d66bff3
BLAKE2b-256 0cdc5e183a805b96087415abe50d8560b3361052f4a91c665dca8b6ba52e079d

See more details on using hashes here.

File details

Details for the file rws_client-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rws_client-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 770926d0a2552feda0e83d4364c74ef03680b305b2dbe08bc5f894f20c90f360
MD5 b84d6868a4bfaea29f5c8dea8cef8e37
BLAKE2b-256 4596411fcf67621d4b55659c905862ccd0af403c8c28ac9b3906f764f28a958c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page