Modify

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#5437 closed task (fixed)

AMF support

Reported by: thijs Owned by: olemis
Priority: high Component: TracRpcProtocolsPlugin
Severity: normal Keywords: rpc
Cc: thijs, olemis, osimons Trac Release: 0.11

Description

PyAMF provides Action Message Format (AMF) support for Python that is compatible with the Adobe Flash Player. It includes integration with Python web frameworks like Django, Pylons, Twisted and SQLAlchemy.

The Adobe Integrated Runtime and Adobe Flash Player use AMF to communicate between an application and a remote server. AMF encodes remote procedure calls (RPC) into a compact binary representation that can be transferred over HTTP/HTTPS or the RTMP/RTMPS protocol. Objects and data values are serialized into this binary format, which increases performance, allowing applications to load data up to 10 times faster than with text-based formats such as XML or SOAP.

It would be great to add AMF support to the XmlRpcPlugin (or TracRpc plugin), similar to the new JSON support, allowing you to query from the Flash Player without requiring any additional Actionscript libraries.

Attachments (2)

amf.patch (12.4 KB) - added by thijs 5 years ago.
amf-client.py (607 bytes) - added by thijs 5 years ago.

Download all attachments as: .zip

Change History (21)

comment:1 Changed 5 years ago by thijs

  • Owner changed from osimons to thijs
  • Status changed from new to assigned
  • Type changed from defect to enhancement

I just realized today that JSON support was added so give it a few days before I can add a patch.

comment:2 Changed 5 years ago by osimons

Adding JSON-RPC was a proof-of-concept for what was needed to provide the support for more protocols to the plugin, and also a test-bed for making all methods protocol agnosting by just working with regular Python types (except xmlrpclib.Binary for the time being). And, it was done in a least-effort/least-obtrusive manner to avoid breaking (or even touching) the XML-RPC code as it was stabilizing from the many recent fixes and improvements.

Next step would be to refactor the core handling of call/input/output/error handling + docs, so that it gets abstracted into protocol-providers using an extension point. That way it becomes simple to add further protocols either to the plugin itself, or as separate plugins.

And yes, renaming the plugin (#5436) would make sense then. As would removing the various /xmlrpc and /jsonrpc urls, and just provide /rpc and /login/rpc that uses content-type or other request information to find the correct provider. That is roughly the essence for my version 1.1.0 plans.

Help welcome :-)

comment:3 Changed 5 years ago by osimons

Should also mention that #5382 was part of the plan - I don't want to do a full rework of the plugin before there is decent coverage in the functional tests that now come with the plugin. Its now quite decent for core functionality, allthough a lot of 'plain' method tests are still missing.

Changed 5 years ago by thijs

Changed 5 years ago by thijs

comment:4 Changed 5 years ago by thijs

  • Owner changed from thijs to osimons
  • Status changed from assigned to new

I added a patch for AMF support using PyAMF (easy_install pyamf) against version 1.0.6 of the plugin. I also included an AMF client for Python.

Some things I need to do are proper error raising and looking into Binary to ByteArray conversion. I hope this patch gives a better impression of the future direction the JSON/AMF/etc support should/could go.

comment:5 Changed 5 years ago by osimons

I've have a working implementation of an IRPCProtocolProvider interface, to completely abstract all communication and content normalization into own modules - and thereby also making it easily pluggable. It has been somewhat slower to finish as I've been busy with other things + middle of summer holiday. I want to review it a bit more + improve docs and make that pluggable too - and get tests for everything running ok.

Thanks for the AMF patch - helpful to correlate the needs of the interface. I'll be back soon-ish with a new infrastructure to allow you to redo it in a cleaner fashion... Stay tuned :-)

comment:6 follow-up: Changed 5 years ago by anonymous

  • Cc olemis added

comment:7 in reply to: ↑ 6 ; follow-up: Changed 5 years ago by olemis

  • Owner changed from osimons to olemis
  • Status changed from new to assigned

Replying to anonymous:

I've have a working implementation of an IRPCProtocolProvider interface, to completely
abstract all communication and content normalization into own modules -
and thereby also making it easily pluggable.


A patch for the protocol API is available. It works with r7194 and is work in progress.


Thanks for the AMF patch - helpful to correlate the needs of the interface.
I'll be back soon-ish with a new infrastructure to allow you to redo it in
a cleaner fashion... Stay tuned :-)


You can clone the patches repository or suscribe to the repository feed in order to get the latest version of the patch.

Feedback is welcome !

:o)

comment:8 Changed 5 years ago by olemis

  • Owner changed from olemis to osimons
  • Status changed from assigned to new

osimons is still in charge ;o)

comment:9 in reply to: ↑ 7 ; follow-up: Changed 4 years ago by olemis

  • Cc osimons added
  • Component changed from XmlRpcPlugin to TracRpcProtocolsPlugin
  • Keywords rpc added
  • Owner changed from osimons to olemis
  • Priority changed from normal to high
  • Type changed from enhancement to task

Replying to olemis:

Replying to anonymous:

I've have a working implementation of an IRPCProtocolProvider interface, to completely
abstract all communication and content normalization into own modules -
and thereby also making it easily pluggable.


A patch for the protocol API is available. It works with r7194 and is work in progress.


Thanks for the AMF patch - helpful to correlate the needs of the interface.
I'll be back soon-ish with a new infrastructure to allow you to redo it in
a cleaner fashion... Stay tuned :-)


You can clone the patches repository or suscribe to the repository feed in order to get the latest version of the patch.


I started a reference implementation based on your previous patch. It will be incorporated in the first release of TracRpcProtocolsPlugin after publishing the new API. With time it might be distributed in official XmlRpcPlugin . If you want to try what's been done or join the development then please reply and I will let you know. For the moment please read this article for further information. It's written in Spanish so, if you prefer, wait until I can either translate it or publish the source code. You could also use Google Translate gadget found in that page.

Your enhancement proposal was very useful.

Thanks !


Feedback is welcome !


Once I publish the source code, I will let you know.

:o)

PS: osimons , feel free to bring it back if you prefer this issue tracked by XmlRpcPlugin ;o)

comment:10 Changed 4 years ago by olemis

  • Status changed from new to assigned

comment:11 Changed 4 years ago by thijs

That's very exciting news and I'm looking forward trying it out!

comment:12 in reply to: ↑ 9 Changed 4 years ago by olemis

Replying to olemis:

For the moment please read this article for further information. It's written in Spanish so, if you prefer, wait until I can either translate it or publish the source code. You could also use Google Translate gadget found in that page.

JFTR english version of the article is available. I'll let you know about the details to try it out ASAIC.

comment:13 follow-up: Changed 4 years ago by olemis

  • Resolution set to fixed
  • Status changed from assigned to closed

I've published the mercurial repository .

In order to try it out it's necessary to qclone XmlRpcPlugin patch queue repository (MQ extension MUST be enabled ;o) and apply the most recent patch(es) i.e.

$ hg qclone http://bitbucket.org/osimons/trac-rpc-mq /path/to/rpc/repos
$ cd /path/to/local/repos
$ hg qpush -a

build from sources and install the plugin (many options BTW). Alternately it's also possible to download latest unstable sdist available at http://bitbucket.org/osimons/trac-rpc-mq/downloads

Then clone the repository

$ hg clone ssh://simelo.hg.sourceforge.net/hgroot/simelo/trac-rpcext /path/to/rpcext/repos

build from sources, enable plugins , ... and follow the instructions found in RPC docs page. That's it !

Feedback is welcome. Enjoy !

comment:14 follow-up: Changed 4 years ago by thijs

So can #5436 be closed now since that became the TracRpcProtocolsPlugin?

comment:15 in reply to: ↑ 14 Changed 4 years ago by anonymous

Replying to thijs:

So can #5436 be closed now

Should remain open . We tried to include that in this patch but it's a non-trivial task. osimons should make a decision.

since that became the TracRpcProtocolsPlugin?

Not exactly . XmlRpcPlugin is not gonna die. TracRpcProtocolsPlugin will be something like a sandbox where other protocols will be implemented. They will remain there 'cause they are experimental, or due to conflicting dependencies, or ... The idea is to transition those components towards XmlRpcPlugin if it's better and appropriate to do so.

comment:16 Changed 4 years ago by osimons

(In [7916]) XmlRpcPlugin: Pluggable protocols through new API + rework of most request-handling internals. Bump version to 1.1.0.

Closes #5437. Big thanks to Olemis Lang for getting this completed.

comment:17 Changed 4 years ago by osimons

A somewhat premature close on this ticket, but at least now the pluggable-protocols code is in the repository and available for general use and extension. Thanks!

comment:18 in reply to: ↑ 13 ; follow-up: Changed 4 years ago by thijs

Replying to olemis:

Then clone the repository

$ hg clone ssh://simelo.hg.sourceforge.net/hgroot/simelo/trac-rpcext /path/to/rpcext/repos

unfortunately this isn't working, I get a login prompt for permissions i don't have afaik. I opened #7097 for that issue. I've also opened a ticket for PyAMF to add some documentation on how to use this plugin. Thanks!

comment:19 in reply to: ↑ 18 Changed 4 years ago by anonymous

Replying to thijs:

Replying to olemis:

Then clone the repository

$ hg clone ssh://simelo.hg.sourceforge.net/hgroot/simelo/trac-rpcext /path/to/rpcext/repos

unfortunately this isn't working, I get a login prompt for permissions i don't have afaik. I opened #7097 for that issue.

You're right, sorry, I specified the address of read/write repository. Try this (worked for me few minutes ago ;o)

$ hg clone http://simelo.hg.sourceforge.net:8000/hgroot/simelo/trac-rpcext /path/to/rpcext/repos

I've also opened a ticket for PyAMF to add some documentation on how to use this plugin. Thanks!

Cool ! Could you please add my email (olemis+trac at gmail.com) to the CC list (can't do that myself :( ) ?

Thnx !

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.