Support event ids
Closed this issue · 5 comments
They seem to be supported in sse
but not via the django views.
In CBV have access to the object "sse" with "self.sse" attribute.
If you think there improve this part, talk and see if they improve.
Andrey
I'm new to SSE, but it seems like I should be able to optionally set the id
on every message. How would you feel about changing the signature of Sse.add_message
to be def add_message(self, event, text, id=None, encoding='utf-8')
. I could work around it, but maybe it is better to set it upstream?
I'm happy to do the work, I'd just like to get your thoughts first.
Currently it has the method sse.set_event_id("some-id")
, which is used to specify the id, and then sse.reset_event_id()
to reset the id.
Within the block with ID can send multiple events. I believe that the implementation matches the specification.
You can look here: http://www.w3.org/TR/eventsource/#concept-event-stream-last-event-id
ok, I should be able to handle the way I'd like (new ID with every message) with a small wrapper function. Having access to self.sse
will give me everything I need. Thanks!
;) If you have any questions or think I can help you. You can ask without any problem. ;)