Closed xtlc closed 2 years ago
Thanks for the report. I've figured out what is going on. The number of calls to sse_encode_event
is as expected (once for each connected client and once for django_grip
). The problem is as the codebase has grown, the json_encode
option hasn't been respected in various places. I suspect setting json_encode=False
right now results in all kinds of misbehavior and shouldn't be used.
I'll fix this very soon.
Fixed in 4.4.1.
Not sure what exactly the issues is here, but I need some help:
When using the function:
the string inside the html returned to the frontend is always "" escaped. ( -> "tesst" instead of tesst, but
<h1>
is applied correctly):I hacked a little bit in the code and found
sse_encode_event(event_type, data, event_id=None, escape=False, json_encode=True)
and I added aprint(f"event_type: {event_type}, json_encode: {json_encode})
statement at the start of the function to see what one call does:What I did to get it working is add
json_encode = False
in the utils.pysse_encode_event()
function for testing.So I tested that with adding a
reply()
function wheresend_event()
is being called like this:This produces:
So what happens is, that there are multiple events being sent out instead of a single one and all but the first ones ignore the
json_encode
setting.