Giter Site home page Giter Site logo

long polling about twister-proxy HOT 4 OPEN

digital-dreamer avatar digital-dreamer commented on September 22, 2024
long polling

from twister-proxy.

Comments (4)

digital-dreamer avatar digital-dreamer commented on September 22, 2024

Hi Tschaul,

so basically, we would need to change twister-html so that it won't make the synchronous RPC calls every second. Instead, twister-proxy would be making these calls to twister-core, and twister-html would be listening on some kind of websocket, waiting from a reply from twister-proxy, which would get triggered by a non-empty reply?

from twister-proxy.

Tschaul avatar Tschaul commented on September 22, 2024

The incoming connections from twister-html would simply be kept alive and stashed aside until twister-proxy gets a non-empty reply. Thats the difference between real push and long polling, no websocket needed. So twister-html would only need a slight change. Instead of sending out the calls every second, it would have to send them out one second after it got the previous one back. Then the request can sit and wait on the proxy until something happens, and when something happens it comes back and a new request is issued. This way twister-html doesn't need to know whether or not there is a proxy doing the repeated polling for it.

from twister-proxy.

digital-dreamer avatar digital-dreamer commented on September 22, 2024

Good idea 👍 First step is to make twister-html ready for use on a public server (I plan to solve some issues with it and make a new pull request to Miguel soon), but this will certainly be a good feature to have.

from twister-proxy.

Tschaul avatar Tschaul commented on September 22, 2024

Having used the twister JSON-RPC a bit more, i think that an empty response is not a good trigger for long polling. I'd much rather have an extra getposts_longpoll method, even though this would mean that twister-html has to adapt more. Or even more advanced, a websocket on which you can subscribe to torrents. JSON-RPC would generally allow that. I found these discussions on the JSON-RPC mailing list:

https://groups.google.com/forum/#!topic/json-rpc/EWnUwcTmOjY
https://groups.google.com/forum/#!topic/json-rpc/5PcrYSfzavA

A websocket would be great, also without long polling. I don't have benchmarks but i guess with the small message bodies that are transfered HTTP has a very big overhead.

Also, related, i found out that the twister-proxy right now does not allow batch-requests but twisterd does. The batch feature is not very useful at the moment because the requests are not carried out concurrently. So there is no speed up and you have to wait for all requests to finish before you get a result back. Not worth a new issue so i mention it here.

from twister-proxy.

Related Issues (8)

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.