Git Product home page Git Product logo

Comments (3)

zh217 avatar zh217 commented on June 3, 2024 1

That's indeed interesting. I will dig deeper to see how to make it browser-compatible out-of-box.

from cozo.

zh217 avatar zh217 commented on June 3, 2024

For /changes/rel, you can test with curl: curl -N localhost:9070/changes/rel and see if it registers any events.

If curl works but nodejs does not, then mostly likely the javascript library is sending headers to the server stating that it is OK with compressed data (like gzip), but when the compressed data actually comes it fails to decode it. We have seen it in python. It seems that most SSE servers do not send compressed data even when asked (but ours do). Just remove the offending headers will make it work.

For /rules, it is not OK to register for multiple times for the same rule name. Also /rules API may change in the next version.

from cozo.

comunidadio avatar comunidadio commented on June 3, 2024

Interesting, I can see the changes with curl indeed.

Actually i'm not using nodejs in my example above, I used Chrome's Javascript Console directly... which I only did after having the same issue first with my go-to Golang SSE library, and then also with another Golang SSE library. All of them (2 Go libraries, and Chrome's standard EventSource) do not register the events.

Weird one, I do not see anything terribly wrong with how cozo returns the SSE indeed - compression does not seem to be an issue with Chrome on some other streans, the only "surprising" thing may be the Transfer-Encoding:chunked (as SSE is already a chunked protocol and could confuse browsers/Go) but looks like axum does not have an easy way to disable it.

I can work directly with TCP and proxy it anyway for my use case but would be so nice to have this compatible with browsers' SSE out-of-the-box.

from cozo.

Related Issues (20)

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.