Implementation of long-polling in asynchronous web framework like twisted or klein












0














I'm relatively new to REST API and web development in general. I'm looking for options for a client GET request to receive data incrementally/streaming until all data is sent with some criterias:




  • Has to be async (need to use twisted/klein as framework), here's only with Flask as reference.

  • Need to render server-side (next.js has option with socket.io in here with react -> which is the frontend I use), I know it's unrelated, but it's nice to have reading materials like that so I can glue/frankensteinize components together.


my model



From the server (python) It has to be yielded from generator object, right? what confusing me is the underlying options/quirks between websocket, long polling, and server-sent-events, not to mention frameworks like autobahn, WAMP and service like pushpin and crossbar.io which I think is overkill for my case.



The reason I'm mentioning them all is to ask for best practice in using them with their many ways of implementation (phew..). It's a bit overwhelming without enough experience.



At the core level (http headers/protocols/curl), what need to be actually set on the client and server given my scenario? And does long polling sounds like the solution? Does async is a good idea?



Reference reading:



What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?



My Understanding of HTTP Polling, Long Polling, HTTP Streaming and WebSockets



http://blog.fanout.io/2016/11/21/moving-from-polling-to-long-polling/



https://blog.al4.co.nz/2016/01/streaming-json-with-flask/



TL;DR: Best practice of long polling implementation in asynchronous python webserver.










share|improve this question






















  • Nevow Athena (based on Twisted Web) uses essentially the low-level technique you describe here to provide a high-level bi-directional symmetric RPC system. It's a fairly obscure library, though, and you may have difficulty finding a supporting community for it.
    – Jean-Paul Calderone
    Nov 12 at 12:41










  • Thank you, I'll take a look at it, it's in the documentation the whole time (twisted web), should've looked there first.
    – Ardhi
    Nov 13 at 0:20
















0














I'm relatively new to REST API and web development in general. I'm looking for options for a client GET request to receive data incrementally/streaming until all data is sent with some criterias:




  • Has to be async (need to use twisted/klein as framework), here's only with Flask as reference.

  • Need to render server-side (next.js has option with socket.io in here with react -> which is the frontend I use), I know it's unrelated, but it's nice to have reading materials like that so I can glue/frankensteinize components together.


my model



From the server (python) It has to be yielded from generator object, right? what confusing me is the underlying options/quirks between websocket, long polling, and server-sent-events, not to mention frameworks like autobahn, WAMP and service like pushpin and crossbar.io which I think is overkill for my case.



The reason I'm mentioning them all is to ask for best practice in using them with their many ways of implementation (phew..). It's a bit overwhelming without enough experience.



At the core level (http headers/protocols/curl), what need to be actually set on the client and server given my scenario? And does long polling sounds like the solution? Does async is a good idea?



Reference reading:



What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?



My Understanding of HTTP Polling, Long Polling, HTTP Streaming and WebSockets



http://blog.fanout.io/2016/11/21/moving-from-polling-to-long-polling/



https://blog.al4.co.nz/2016/01/streaming-json-with-flask/



TL;DR: Best practice of long polling implementation in asynchronous python webserver.










share|improve this question






















  • Nevow Athena (based on Twisted Web) uses essentially the low-level technique you describe here to provide a high-level bi-directional symmetric RPC system. It's a fairly obscure library, though, and you may have difficulty finding a supporting community for it.
    – Jean-Paul Calderone
    Nov 12 at 12:41










  • Thank you, I'll take a look at it, it's in the documentation the whole time (twisted web), should've looked there first.
    – Ardhi
    Nov 13 at 0:20














0












0








0







I'm relatively new to REST API and web development in general. I'm looking for options for a client GET request to receive data incrementally/streaming until all data is sent with some criterias:




  • Has to be async (need to use twisted/klein as framework), here's only with Flask as reference.

  • Need to render server-side (next.js has option with socket.io in here with react -> which is the frontend I use), I know it's unrelated, but it's nice to have reading materials like that so I can glue/frankensteinize components together.


my model



From the server (python) It has to be yielded from generator object, right? what confusing me is the underlying options/quirks between websocket, long polling, and server-sent-events, not to mention frameworks like autobahn, WAMP and service like pushpin and crossbar.io which I think is overkill for my case.



The reason I'm mentioning them all is to ask for best practice in using them with their many ways of implementation (phew..). It's a bit overwhelming without enough experience.



At the core level (http headers/protocols/curl), what need to be actually set on the client and server given my scenario? And does long polling sounds like the solution? Does async is a good idea?



Reference reading:



What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?



My Understanding of HTTP Polling, Long Polling, HTTP Streaming and WebSockets



http://blog.fanout.io/2016/11/21/moving-from-polling-to-long-polling/



https://blog.al4.co.nz/2016/01/streaming-json-with-flask/



TL;DR: Best practice of long polling implementation in asynchronous python webserver.










share|improve this question













I'm relatively new to REST API and web development in general. I'm looking for options for a client GET request to receive data incrementally/streaming until all data is sent with some criterias:




  • Has to be async (need to use twisted/klein as framework), here's only with Flask as reference.

  • Need to render server-side (next.js has option with socket.io in here with react -> which is the frontend I use), I know it's unrelated, but it's nice to have reading materials like that so I can glue/frankensteinize components together.


my model



From the server (python) It has to be yielded from generator object, right? what confusing me is the underlying options/quirks between websocket, long polling, and server-sent-events, not to mention frameworks like autobahn, WAMP and service like pushpin and crossbar.io which I think is overkill for my case.



The reason I'm mentioning them all is to ask for best practice in using them with their many ways of implementation (phew..). It's a bit overwhelming without enough experience.



At the core level (http headers/protocols/curl), what need to be actually set on the client and server given my scenario? And does long polling sounds like the solution? Does async is a good idea?



Reference reading:



What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?



My Understanding of HTTP Polling, Long Polling, HTTP Streaming and WebSockets



http://blog.fanout.io/2016/11/21/moving-from-polling-to-long-polling/



https://blog.al4.co.nz/2016/01/streaming-json-with-flask/



TL;DR: Best practice of long polling implementation in asynchronous python webserver.







python-3.x web-services asynchronous twisted klein-mvc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 at 11:28









Ardhi

631513




631513












  • Nevow Athena (based on Twisted Web) uses essentially the low-level technique you describe here to provide a high-level bi-directional symmetric RPC system. It's a fairly obscure library, though, and you may have difficulty finding a supporting community for it.
    – Jean-Paul Calderone
    Nov 12 at 12:41










  • Thank you, I'll take a look at it, it's in the documentation the whole time (twisted web), should've looked there first.
    – Ardhi
    Nov 13 at 0:20


















  • Nevow Athena (based on Twisted Web) uses essentially the low-level technique you describe here to provide a high-level bi-directional symmetric RPC system. It's a fairly obscure library, though, and you may have difficulty finding a supporting community for it.
    – Jean-Paul Calderone
    Nov 12 at 12:41










  • Thank you, I'll take a look at it, it's in the documentation the whole time (twisted web), should've looked there first.
    – Ardhi
    Nov 13 at 0:20
















Nevow Athena (based on Twisted Web) uses essentially the low-level technique you describe here to provide a high-level bi-directional symmetric RPC system. It's a fairly obscure library, though, and you may have difficulty finding a supporting community for it.
– Jean-Paul Calderone
Nov 12 at 12:41




Nevow Athena (based on Twisted Web) uses essentially the low-level technique you describe here to provide a high-level bi-directional symmetric RPC system. It's a fairly obscure library, though, and you may have difficulty finding a supporting community for it.
– Jean-Paul Calderone
Nov 12 at 12:41












Thank you, I'll take a look at it, it's in the documentation the whole time (twisted web), should've looked there first.
– Ardhi
Nov 13 at 0:20




Thank you, I'll take a look at it, it's in the documentation the whole time (twisted web), should've looked there first.
– Ardhi
Nov 13 at 0:20

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261219%2fimplementation-of-long-polling-in-asynchronous-web-framework-like-twisted-or-kle%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261219%2fimplementation-of-long-polling-in-asynchronous-web-framework-like-twisted-or-kle%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma