Git Product home page Git Product logo

Comments (5)

niwinz avatar niwinz commented on August 18, 2024

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

from django-sse.

ipmb avatar ipmb commented on August 18, 2024

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.

from django-sse.

niwinz avatar niwinz commented on August 18, 2024

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

from django-sse.

ipmb avatar ipmb commented on August 18, 2024

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!

from django-sse.

niwinz avatar niwinz commented on August 18, 2024

;) If you have any questions or think I can help you. You can ask without any problem. ;)

from django-sse.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.