Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-lightstreamer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-lightstreamer

  • 0.1.7
  • PyPI
  • Socket score

Maintainers
1

Async Light Streamer Client

This project is based on lightstreamer-client

Install

pip install async-lightstreamer
# or if you are using poetry
poetry add async-lightstreamer

Task Group

This client creates a task for receving new messages You can pass TaskGroup to LightstreamerClient, and client will use given TaskGroup for creating task

async with asyncio.TaskGroup() as tg:
    async_lightstreamer.LightstreamerClient(
        lightstreamer_username="<username>",
        lightstreamer_password="<password>",
        lightstreamer_url="<url>",
        adapter_set="<adapter>",
        task_group=tg,
    )

Reconnect

If you set should_reconnect flag to true in LightstreamerClient, client will reconnect and subscribe all subscriptions

async_lightstreamer.LightstreamerClient(
    lightstreamer_username="<username>",
    lightstreamer_password="<password>",
    lightstreamer_url="<url>",
    adapter_set="<adapter>",
    should_reconnect = True,
    reconnect_retries = 100, # set to -1 for infitine retry
)

Example

import asyncio
import async_lightstreamer

async def main():
    lc = async_lightstreamer.LightstreamerClient(
        lightstreamer_username="<username>",
        lightstreamer_password="<password>",
        lightstreamer_url="<url>",
        adapter_set="<adapter>",
    )
    await lc.connect()
    async def callback(data) -> None:
        print(data)

    await lc.subscribe(
        subscription=async_lightstreamer.LightstreamerSubscription(
            mode=async_lightstreamer.Mode.MERGE,
            items=["item1", "item2"],
            fields=["field1", "field2"],
            adapter="adapter",
        ).addlistener(callback),
    )
    await asyncio.sleep(60)
    await lc.disconnect()


asyncio.run(main())

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc