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.3.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.3-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rws_client-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 904dd692dad77d06ff47bd5bd6f23ad038c94ffffe88e99397caf9a4553ba851
MD5 90170510ccfee3e6467df5e9340d69d7
BLAKE2b-256 b8908011d6e005abbb6c178844bdbed3f03cd487195e4f1ebc4ca58e4d33637f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rws_client-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 30530dd00c8fb9fc5cf2284555cdf9d94f1b16da757e7fef4207c413a5b00381
MD5 c2b52d86891cb9b24668ee510afd1416
BLAKE2b-256 b49cf8da48c0988992f59f09d1720dc07ae8b766a4adb36705e28401d24e517b

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