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
- Supports 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
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.5.tar.gz
(50.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncpusher-0.2.5.tar.gz.
File metadata
- Download URL: asyncpusher-0.2.5.tar.gz
- Upload date:
- Size: 50.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aa178ac501a213b90d696f5052d0a86aad68a892b596b75f9e1de55172e6111
|
|
| MD5 |
c2be9d9e5134020ddecaffda0bb3dc3d
|
|
| BLAKE2b-256 |
44b438e16e40470f91211ba66ec4688d936b32a40499d0452d847650cb3cd8b9
|
File details
Details for the file asyncpusher-0.2.5-py3-none-any.whl.
File metadata
- Download URL: asyncpusher-0.2.5-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3527e73abafdbbded8403d1dadd14423ddcf92344f6f7cf3fd3c51878cca00fd
|
|
| MD5 |
bca0c7ad31af30d89631911555cbda64
|
|
| BLAKE2b-256 |
8d9753e106c1cfe049b3771847c2a0d726cef1b9d1bf9c289754e7f3e1f9534e
|