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.2.tar.gz (7.8 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.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rws_client-0.1.2.tar.gz
  • Upload date:
  • Size: 7.8 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.2.tar.gz
Algorithm Hash digest
SHA256 26b816e3df47e86f113808a4a5c599a86bed4324d16a71d1d314347c301152f2
MD5 c4e21d7428b95d4b0b4bdc999b63696e
BLAKE2b-256 1fecb33dcd3669e85a3f0c8d801c812e96be45245640e71dad60ecf2f1a036ee

See more details on using hashes here.

File details

Details for the file rws_client-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: rws_client-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6634449786ead94c79544549223feb651e04f303eadf2fb769a3d7531bdde2f6
MD5 4cb7d792b348e98102e076083a2a80a9
BLAKE2b-256 f19e713bb7975d5d832239299c7548cbb1e0d6507fb4d3749c9e19a569e25708

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