easyXDM v1.8.0 relased

A lot has been going on with easyXDM over the past week, and I am proud to finally be able to release a version where all transport types, even the ones for IE6, deliver the same set of features.

From now on all the transports (and all the relying classes) supports

  • Reliability, ‘guaranteed’ delivery of messages
    The new ReliableBehavior adds this to the HashTransport
  • Sender-verification,  verifying that the message originates from the original sender. This removes the risk of malicious sites spoofing the sender
    This is added to the HashTransport and NameTransport by the VerifyBehavior
  • Queueing, you can now send multiple messages in the same js thread
    This is added to the HashTransport and NameTransport by the QueueBehavior

Behaviors

So what are these behaviors mentioned? Well, a behavior modifies the way a transport works, and it works by sending all events and messages through a pipeline of behaviors, where each one can let it pass, inspect it, modify it, block it etc. Each behavior is automatically chained with the others so that they form a stack, where in principal, each layer talks to the corresponding layer on the other end.

One example of this in action is the fragmentation. When the QueueBehavior receives an outgoing message that is larger than the max fragment size, then instead of queueing only one message, it will queue each fragment with a fragment identifier. The QueueBehaviors dispatcher will then send each message as fast as it can (it gets a callback from the next Behavior in he line when the message is delivered).

On the other end multiple ingoing messages will received at the QueueBehavior, but the message won’t be passed on until all fragments has arrived.

Using behaviors instead of applying the functionality directly to the classes adds a lot to the table

  • Re-usability, the same behavior can be applied to all transports that accepts these.
  • Separation, each new feature is contained in a separate class, and since the pipeline is layered, you can safely introduce e.g sender-verification without risking breaking the code that handles the sending/receiving.
  • Structure, the code is a lot easier to read and understand, and adding new behaviors is a breeze.

This is a sample from the HashTransport and shows how behaviors are applied internally

easyXDM.applyBehaviors(this, [
    new easyXDM.transport.behaviors.ReliableBehavior({
        timeout: ((useResize ? 50 : pollInterval * 1.5) + (usePolling ? pollInterval * 1.5 : 50))
    }),
    new easyXDM.transport.behaviors.QueueBehavior({
        maxLength: 4000 - _remoteUrl.length
    }),
    new easyXDM.transport.behaviors.VerifyBehavior({
        initiate: isHost
    })
]);

In the future these will be overridable, and you will be able to inject your own if you want to.

Conclusion

If you haven’t already, go download the newest version and enjoy the new features!

Tags: , , , , , ,

This entry was posted on Saturday, February 27th, 2010 at 21:19 and is filed under easyXDM. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

  • http://kinsey.no/ Øyvind Sean Kinsey

    A small bug was discovered that would affect large messages sent using the HashTransport.
    The bug only affected messages that would increase in size with more than ~100 characters when being encoded.

    http://github.com/oyvindkinsey/easyXDM/commit/1ef

  • http://oyvind.kinsey.no/ Øyvind Sean Kinsey

    A small bug was discovered that would affect large messages sent using the HashTransport.
    The bug only affected messages that would increase in size with more than ~100 characters when being encoded.

    http://github.com/oyvindkinsey/easyXDM/commit/1ef

  • http://infiniterealities.org/dolphin/blogs/entry/G-s-Hap-r-nleri Göğüs Hapı Ürünleri

    kendime başka bir aşk bulurum.

  • 建镔 陈

    When NameTransport sending message, the ‘Secret’ will write into name.html’s window.name which is readable by all script (in the same origin). I can listen to the name.html’s onload event and catch the ‘Secret’.

    • http://kinsey.no/ Øyvind Sean Kinsey

      Well, yes – why is this a problem?
      The secret is there to avoid window hijacking – if are on the same origin, then you already have access to anything anyway.