1


I'm interested in doing data-push from django to flex, can this be done using pyamf (tutorials or examples are highly appreciated)?
I would like to do it in such a way that when something is changed in the database, the client are notified of that change.

Darth Plagueis
  • 910
  • 3
  • 21
  • 39
  • I think you need to be more specific with your second question but then again, maybe all you need are tutorials. What did the quick Google search bring up? –  Apr 29 '11 at 17:10
  • @geekam :i found some examples ... but non of them do this .. as for ur first comment(about being more specific): have a database that has a table called cars for example... and whenever some client adds an entry in that table, i want the rest of the clients to be notified that there is a new car now. i hope this makes it clearer – Darth Plagueis Apr 29 '11 at 18:29

1 Answers1

2

I haven't done it, and it looks difficult.

What does BlazeDS Livecycle Data Services do, that something like PyAMF or RubyAMF not do?

PyAMF gives you the tools to send and receive AMF messages in Python.

But Django isn't suited to push, as normally for push you'd use socket connections rather than HTTP.

Which probably means having a Twisted server as well. You could still use Django... you'd maybe have signals code in your models telling the Twisted server to send a message back to the Flex client.

You'd still have to write all the data-binding type code yourself on the Flex side, though PyAMF provide example client code to get you started.

Apparently the Java frameworks for Flex do code generation for both sides, making it all much easier.

Community
  • 1
  • 1
Anentropic
  • 32,188
  • 12
  • 99
  • 147
  • is it possible to do it using cherrypy instead of Django? – Darth Plagueis Apr 29 '11 at 22:03
  • I think CherryPy has the same problem as Django: WSGI is a synchronous request/response cycle API, so it is hard to do 'push' or two-way socket type of code well. From what I've read CherryPy can do things like Comet (http push) http://tools.cherrypy.org/wiki/Comet via threading - but this ties up a thread per open connection, which is why people prefer async servers for this stuff. See also experimental (html5) Web Sockets code for CherryPy: http://www.defuze.org/archives/232-websocket-for-cherrypy-32.html – Anentropic May 09 '11 at 22:17
  • 1
    Here's someone actually doing Django->Flex via PyAMF. Not sure if they are 'pushing' but maybe they can help further: http://stackoverflow.com/questions/481110/how-can-i-use-flex-to-access-foreign-keyed-fields-in-django – Anentropic May 09 '11 at 22:22