Skip to main content

WebSocket client for EnSync Engine - real-time messaging over WebSocket

Project description

EnSync WebSocket Client

WebSocket client for EnSync Engine. An alternative to the gRPC client for environments where WebSocket is preferred or required.

Installation

pip install ensync-websocket

Quick Start

from ensync_websocket import EnSyncEngine

# Initialize engine
engine = EnSyncEngine("wss://node.ensync.cloud")

# Create authenticated client
client = await engine.create_client("your-app-key")

# Publish an message
await client.publish(
    "orders/status/updated",
    ["recipient-app-id"],
    {"order_id": "123", "status": "completed"}
)

# Subscribe to messages
subscription = await client.subscribe("orders/status/updated")

async def handle_message(message):
    print(f"Received: {message['payload']}")

subscription.on(handle_message)

Features

  • WebSocket Protocol: Real-time bidirectional communication
  • Automatic Reconnection: Handles connection failures gracefully
  • TLS Support: Secure WebSocket (WSS) connections
  • Hybrid Encryption: End-to-end encryption with Ed25519 and AES-GCM
  • Event Acknowledgment: Manual or automatic message acknowledgment
  • Event Replay: Request historical messages by ID
  • Pause/Resume: Control message flow with subscription pause/continue

Connection Options

# Secure WebSocket (production)
engine = EnSyncEngine("wss://node.ensync.cloud")

# Insecure WebSocket (development)
engine = EnSyncEngine("ws://localhost:8080")

# With options
engine = EnSyncEngine("wss://node.ensync.cloud", {
    "enableLogging": True,
    "reconnect_interval": 5000,
    "max_reconnect_attempts": 10
})

When to Use WebSocket vs gRPC

Use WebSocket when:

  • You need browser compatibility
  • Your infrastructure has better WebSocket support
  • You're working in restricted environments where gRPC is blocked
  • You prefer text-based protocols for debugging

Use gRPC when:

  • You need maximum performance
  • You're building server-to-server communication
  • You want built-in load balancing and service mesh integration
  • Binary protocol efficiency is important

For most production use cases, we recommend the ensync-grpc package for better performance.

Documentation

For complete documentation, examples, and API reference, visit:

Related Packages

  • ensync-core: Core utilities (automatically installed as dependency)
  • ensync-grpc: High-performance gRPC client (recommended for production)

License

MIT License - see LICENSE file for details

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

ensync_sdk_ws-0.4.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

ensync_sdk_ws-0.4.2-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file ensync_sdk_ws-0.4.2.tar.gz.

File metadata

  • Download URL: ensync_sdk_ws-0.4.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ensync_sdk_ws-0.4.2.tar.gz
Algorithm Hash digest
SHA256 7d6d883fca5071169182651511f9a9891ef9add5785c411efe064ca499131a7e
MD5 e847254f6e03fd8ee6ce1d79cc0a29b9
BLAKE2b-256 091d967d4a89223cbbc3d6f7fe8c4b011a240081237b0a3a5c982bcba2da15da

See more details on using hashes here.

File details

Details for the file ensync_sdk_ws-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: ensync_sdk_ws-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ensync_sdk_ws-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e50baeaf4e39b8971203cd742a43ad368f88ffacfbabe8d157c4347a4b4b3caf
MD5 a3bf977b6aa1c12a929b3f92033e8093
BLAKE2b-256 49dcf242054c5441fc7e43f992789ee429c9d809e1e1af7d1dc02914bf3c78f2

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