Skip to main content

ActionCable Client - A Python 3 client for Rails' Action Cable

pipeline status coverage report Latest Release

This library handles the connections and subscriptions and monitors the connection. It removes the underlaying websocket layer.

Currently authentication is not managed by this library.

Credits

The project originate this that was stalled for more than 5 years.

ROADMAP

See Roadmap file

Get started

sudo pip3 install actioncable_client

Example usage

Setup the connection

Setup the connection to your Action Cable server.

from actioncable.connection import Connection

connection = Connection(url='wss://url_to_your_cable_server/cable', origin='https://url_to_your_cable_server')
connection.connect()

Subscribe to a channel

from actioncable.subscription import Subscription

subscription = Subscription(connection, identifier={'channel': 'YourChannelCLassName'})

def on_receive(message: dict):
  print('New message arrived!')
  print('Action: {} | Data: {}'.format(message['action'], message['data']))

subscription.on_receive(callback=on_receive)
subscription.create()

Send data

from actioncable.message import Message

message = Message(action='update_something', data={'something': 'important'})

subscription.send(message)

Unsubscribe

subscription.remove()

Close connection

connection.disconnect()

Development

Pull it up!

You need help?

Ask a question on StackOverflow with the tag 'actioncable-client'.

Contribution

Create pull requests on GitLab and help us to improve this package. There are some guidelines to follow:

  • Follow the conventions
  • Test all your implementations
  • Document methods which aren't self-explaining
  • try to follow the Roadmap

Copyright (c) 2024 Liant SASU, MIT license

Release files for actioncable-client 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for actioncable-client 0.3.0
File Size Uploaded
actioncable_client-0.3.0.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for actioncable-client 0.3.0
File Interpreter ABI Platform
actioncable_client-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / actioncable_client-0.3.0.tar.gz

Download URL actioncable_client-0.3.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
81d2bb9623b68b3d0a5ddee79a0aed348becf6d4d94364b27254b24aec7bd0b1
BLAKE2b-256 checksum
How to use checksums
eabceb84c11ffa0b4855cb0d8fa81949ed2681ecf00aab28a70d4a47fa3dcbbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / actioncable_client-0.3.0-py3-none-any.whl

Download URL actioncable_client-0.3.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54416adb943f7bacdbca7c62063d41ec45cbfbc6e87cd7e4b4a124452916acbe
BLAKE2b-256 checksum
How to use checksums
240fce083a9b4873ffafa64231d640bdca193e92fb4f919b4c56be04ca8af016
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page