Skip to main content

An event-driven WebSocket library for Python.

Project description

wsaio is a callback-based WebSocket library for Python.

Examples

import asyncio

from wsaio import WebSocketClient


class EchoClient(WebSocketClient):
    async def on_text(self, data):
        await self.write(data)

    async def on_binary(self, data):
        await self.write(data, binary=True)


async def main(loop):
    client = EchoClient(loop=loop)

    await client.connect('wss://localhost/helloWorld')
    await client.wait_until_closed()


loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))

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

wsaio-1.0.0.tar.gz (13.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page