Skip to main content

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())

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)

Uploaded Source

Built Distribution

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

asyncpusher-0.2.5-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for asyncpusher-0.2.5.tar.gz
Algorithm Hash digest
SHA256 0aa178ac501a213b90d696f5052d0a86aad68a892b596b75f9e1de55172e6111
MD5 c2be9d9e5134020ddecaffda0bb3dc3d
BLAKE2b-256 44b438e16e40470f91211ba66ec4688d936b32a40499d0452d847650cb3cd8b9

See more details on using hashes here.

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

Hashes for asyncpusher-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3527e73abafdbbded8403d1dadd14423ddcf92344f6f7cf3fd3c51878cca00fd
MD5 bca0c7ad31af30d89631911555cbda64
BLAKE2b-256 8d9753e106c1cfe049b3771847c2a0d726cef1b9d1bf9c289754e7f3e1f9534e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page