An asynchronous Pusher client library
Project description
asyncpusher is an asynchronous python client library for Pusher
Features
- Uses well-maintained aiohttp's websocket library
- Reliable connection
- Auto handles reconnection
- Asynchronous
- Fast
- Supports Pusher Channels protocol 7
- Support presence and private channels
Install
$ python3 -m pip install asyncpusher
Usage
import asyncio
import logging
import sys
from asyncpusher.channel import Channel
from asyncpusher.pusher import Pusher
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
async def handle_event(data):
logging.info(f"{market} {data}")
async def main():
loop = asyncio.get_running_loop()
pusher = Pusher("<PUSHER_APP_KEY>", loop=loop)
pusher.channels[channel_name] = channel
await pusher.connect()
channel_name = "<CHANNEL_NAME>"
channel = await pusher.subscribe(channel_name)
channel.bind("diff", handle_event)
await asyncio.sleep(5)
await pusher.unsubscribe(channel_name)
await asyncio.sleep(1)
await pusher.disconnect()
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asyncpusher-0.2.0.tar.gz
(37.2 kB
view details)
Built Distribution
File details
Details for the file asyncpusher-0.2.0.tar.gz
.
File metadata
- Download URL: asyncpusher-0.2.0.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8006063714f5509e84bd6653f4df57987b411ae9eb0a12dd253e7667c03e3834 |
|
MD5 | 038e79ae2a0aadafaa5f04f45c79f821 |
|
BLAKE2b-256 | 2ed397adb17ffe853a326e1587b631882f413d770afbba84f2fb9b854e26e4c2 |
File details
Details for the file asyncpusher-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: asyncpusher-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb0db82b4276954271d1585639276d4b88f1913f26ac0735e6543991494806e7 |
|
MD5 | a9b3db8eccf6ab68a605c6b90b506e09 |
|
BLAKE2b-256 | 5c116109c9b7485b3c3034cd2cfb25e2ed257abcbc6e8916b00ab4466ca9e2f8 |