[Twisted-Python] AMP WebSockets bridging
Glyph
glyph at twistedmatrix.com
Sat Jun 16 15:51:58 MDT 2012
On Jun 16, 2012, at 6:45 AM, Laurens Van Houtven wrote:
> Do you think that for old browsers (that is ie6 & 7) it's acceptable to tell them to go install chrome frame? ( for Franck and hence twisteds future bug tracker). If the answer is yes, is that because it will take a while to switch, or would that also be true today?
I think it's acceptable for *Twisted*'s bug tracker to just tell them to install a different browser, because who cares? ;-)
See here: http://www.sitemeter.com/?a=stats&s=sm7twistedmatrix&r=13
Only 5% of our traffic comes from IE, only 1% comes from IE7 and we don't get any from IE6.
Obviously these metrics don't apply to a general solution, of course.
> I'm not sure I understand at which point that takes effect since apparently AMP.sendBox is too late?
I *think* the right place to hook in would be IResponderLocator.
If you write your own locateResponder, you can do your own serialization, except in your case a "string" (for the purposes of toString/fromString) is just a JSON data structure, and an "object" is the corresponding Python data structure which is almost always the same. This is a slight abuse of the API, but it will allow for maximal re-use of all the dispatching logic. You will probably need to touch a private attribute or two, most noticeably _commandDispatch; you need to stuff your own wrapper around commandClass (that proxies 'arguments' and 'response' attributes to wrap them in something that does the requisite adaptation to change the meaning of fromString/toString) in locateResponder, you don't want to override all the behavior.
Then you override sendBox to just do plain old JSON serialization and you're done.
Please feel free to file bugs on any private parts of the API that you need to touch in order to make an alternate serialization. The inability to programmatically discover which methods are responders and what commands they are responders for using a public API strikes me as a glaring oversight.
-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20120616/7b5efbea/attachment-0001.html>
More information about the Twisted-Python
mailing list