AutobahnPython custom JSON serializer

#1

Hello,

I’m interested in using a custom serializer for writing out JSON for certain objects, but I’m not sure how to make this work in AutobahnPython. I found some messages on the group from 2013 but the suggestions (override _serialize / _deserialize) seem outdated now. Is there still a way to do this?

Our use case is basically that we’re consuming binary protocol buffer data from an external source which needs to be converted to JSON to send to websocket clients. The messages are large and converting to Python structures as an intermediary representation has become a bottleneck, so we’d like to sub this out for a C/Cython module that will do the conversion directly and spit out the resulting JSON.

Thanks,
Paul

0 Likes

#2

Hello Paul,

In the example about mongodb https://groups.google.com/forum/#!topic/autobahnws/aZcsudxFMMo there is a custom serializer/deserializer to handle specific bson data. I don’t know if it is what to mean as “outdated”, but works :slight_smile:

···

Le mercredi 1 avril 2015 21:58:29 UTC+2, Paul Dovydaitis a écrit :

Hello,

I’m interested in using a custom serializer for writing out JSON for certain objects, but I’m not sure how to make this work in AutobahnPython. I found some messages on the group from 2013 but the suggestions (override _serialize / _deserialize) seem outdated now. Is there still a way to do this?

Our use case is basically that we’re consuming binary protocol buffer data from an external source which needs to be converted to JSON to send to websocket clients. The messages are large and converting to Python structures as an intermediary representation has become a bottleneck, so we’d like to sub this out for a C/Cython module that will do the conversion directly and spit out the resulting JSON.

Thanks,
Paul

0 Likes