You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use SSE to query the events of items from openHAB. I can do this there via the REST API. However, I have a problem with images. If I change a large image and replace it with a small one, the SSE events do not break.
However, if I replace a small image with a large one, it fails tremendously.
Here the part of my code:
import json
import pprint
import sseclient
if __name__ == "__main__":
events = sseclient.SSEClient("http://192.168.0.5:8080/rest/events?topics=openhab/items/testImage/state")
for event in events:
print(event)
print(type(event))
print(type(event.data))
print(len(event.data))
pprint.pprint(event)
try:
if len(event.data) > 0:
data = json.loads(event.data)
event_topic = data.get("topic")
event_item_name = event_topic.split("/")[2]
event_payload = eval(data.get("payload"))
event_type = data.get("type")
print(event_item_name)
except json.decoder.JSONDecodeError:
print("Event could not be converted from JSON")
I check it in return with Curl, of course. There I see that a big event is arriving.
Or in other words: Instead of receiving anything big, I suddenly receive nothing at all. The loop makes another iteration. That's all well and good. But for some reason this event is then empty. My assumption would be that it would be too large to be processed.
Hi,
I use SSE to query the events of items from openHAB. I can do this there via the REST API. However, I have a problem with images. If I change a large image and replace it with a small one, the SSE events do not break.
However, if I replace a small image with a large one, it fails tremendously.
Here the part of my code:
I check it in return with Curl, of course. There I see that a big event is arriving.
If I run my Python script, I get:
Or in other words: Instead of receiving anything big, I suddenly receive nothing at all. The loop makes another iteration. That's all well and good. But for some reason this event is then empty. My assumption would be that it would be too large to be processed.
This is the equvialent command with curl:
I receive:
It would be definitely too long to post the whole answer because an image is very long.
The text was updated successfully, but these errors were encountered: