Hey Glyph thanks for responding so promptly! First if I understand correctly on the server-side we have some code like:<br><br>def get_data_updates():<br>   if (!has_updates):<br>      return NO_DATA<br>   return json.encode(the_updates)<br>
<br>and on the client side<br><br>def poll_for_updates():<br>   while True:<br>      response = service.get_data_updates()<br>      if response != NO_DATA: break<br>      sleep(1)<br>   do_something_with_response(response)<br>
   poll_for_updates()<br><br>As far as I can tell doing this has NO guarantee that all messages are delivered unless every server-&gt;client connection maintains a stack of &quot;new&quot; messages, whereas in a message-brokered setting the server just keeps sending &quot;global&quot; updates as they occur, and the broker guarantees that clients will receive every one. Where as in this situation, since the client is asking the server for updates, unless the server strictly maintains all of the updates for a specific client, some of them might be thrown on the ground.<br>
<br>Am I correct here?<br><br><br><br><div class="gmail_quote">On Tue, Oct 6, 2009 at 8:46 PM, Glyph Lefkowitz <span dir="ltr">&lt;<a href="mailto:glyph@twistedmatrix.com">glyph@twistedmatrix.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div class="im">On Tue, Oct 6, 2009 at 11:30 PM, Stephen Mattison <span dir="ltr">&lt;<a href="mailto:stephenmattison@gmail.com" target="_blank">stephenmattison@gmail.com</a>&gt;</span> wrote:<br>
<div>  <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
How can I implement this in Twisted?<br></blockquote></div><div><br>You can use DeferredResource:<br><br>    <a href="http://twistedmatrix.com/documents/8.2.0/api/twisted.web.util.DeferredResource.html" target="_blank">http://twistedmatrix.com/documents/8.2.0/api/twisted.web.util.DeferredResource.html</a><br>

<br></div></div>or you can return NOT_DONE_YET from Resource.render(), and hold on to the request:<br><br>    <a href="http://twistedmatrix.com/documents/8.2.0/api/twisted.web.resource.Resource.html#render" target="_blank">http://twistedmatrix.com/documents/8.2.0/api/twisted.web.resource.Resource.html#render</a><br>

<br>to leave the connection open until something happens.<br><br>For a more elaborate example of a long-polling server component, you could see Nevow&#39;s Athena:<br><br>    <a href="http://www.divmod.org/trac/wiki/DivmodNevow/Athena" target="_blank">http://www.divmod.org/trac/wiki/DivmodNevow/Athena</a><br>

<br>This does not implement JSON-RPC or XML-RPC, but it has lots of code for managing the outstanding connection, which may give you some ideas.<br><font color="#888888"><br>-Glyph<br><br>
</font><br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Stephen Mattison<br>