dispersy icon indicating copy to clipboard operation
dispersy copied to clipboard

Message generation/parsing overhaul

Open whirm opened this issue 11 years ago • 3 comments

As talked previously with Lipu and Niels,

The community class would get two new methods:

  • register_message() which receives more or less the same args as the Message classes we now put on the list returned by initiate_meta_messages() in addition to the message id number, which will build a message factory for this message type and register it into the community.

  • reregister_message() (better name anybody?) which unregisters the previous message with the same name/message id number and registers the passed one as its replacement.

    The factory will have:

  • new() method which return a message instance, filled with everything that can be automatically guessed or doesn't change between messages in a specific community (IE global time)

The community gets a convert_packet() method to parse binary messages to objects.

The messages will now extend construct.Container and will have methods such as:

  • packet property that dynamicaly serializes the packet.

Feel free to edit this post to extend/rectify.

whirm avatar Jun 12 '14 15:06 whirm

Some nice things Niels found related to its implementation:

http://blog.namis.me/2012/02/16/python-class-factory/

http://blog.namis.me/2012/02/15/python-caching-using-defaultdict/

whirm avatar Jun 12 '14 15:06 whirm

@whirm how's this going btw? Do you have a branch in wherein we got the decoding to work?

NielsZeilemaker avatar Jan 05 '15 15:01 NielsZeilemaker

I haven't been able to work on this at all :(

whirm avatar Jan 06 '15 11:01 whirm