Skip to content

How to implement onStatusChange #333

Answered by bug-or-feature
starsnpixel asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a quick and dirty way to do it. First define a subclass of Client Listener

from lightstreamer.client import (
    ClientListener,
)

class StatusListener(ClientListener):
    def onStatusChange(self, status):
        print(f"{datetime.now()}: ***** {status} *****")

then add an instance as a listener to the client. In the stream sample do it just before wait_for_input()

ig_stream_service.ls_client.addListener(StatusListener())

I'll add a better way to do it in the next release, so you don't need to access the client directly

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@starsnpixel
Comment options

Answer selected by starsnpixel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants