Skip to main content

Python implementation of the Firebase WebChannel protocol

Project description

python-webchannel

Minimal Python implementation of the Firebase WebChannel protocol. Provides a native Python transport compatible with Firestore's WebChannel-based streaming API.

import asyncio

from python_webchannel import (
    WebChannelOptions,
    create_web_channel_transport,
    EventType,
)


async def main() -> None:
    transport = create_web_channel_transport()
    channel = transport.create_web_channel(
        "https://example.com/google.firestore.v1.Firestore/Listen/channel",
        WebChannelOptions(
            message_url_params={"database": "projects/demo/databases/(default)"},
            http_session_id_param="gsessionid",
            send_raw_json=True,
        ),
    )

    channel.listen(EventType.MESSAGE, lambda event: print("message", event.data))
    await channel.open()
    await channel.send({"example": "payload"})

    # ... use the channel ...

    await channel.close()


if __name__ == "__main__":
    asyncio.run(main())

Status

Early preview. The implementation currently focuses on unidirectional streaming compatible with Firestore. Additional protocol features (multiplexing, origin trials, buffering proxy detection) will be added incrementally.

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

python_webchannel-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

python_webchannel-0.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file python_webchannel-0.1.0.tar.gz.

File metadata

  • Download URL: python_webchannel-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for python_webchannel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ad568a13658fb640f5d850e7ecd907a391ec70e65742a075f313b4e2556be9d
MD5 fabb8e69ded45a4cce6a07fd88c8a4d4
BLAKE2b-256 159afa0411a348db2f590ad9ef2abda01f7bdff591309455aadd8ea5083feb36

See more details on using hashes here.

File details

Details for the file python_webchannel-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_webchannel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b6ae43b49d5b18da7a7a91e2d03b7a0bf15f0169fbe33cff5f5c25a0b3a95fb
MD5 6895467c59cc899cc20d494308c3c1ff
BLAKE2b-256 93e2a6f83ea3c503f06b2a11c4317e852a1c9da5cdd2d9bf173101219690770c

See more details on using hashes here.

Supported by

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