fredagen den 25:e februari 2011

Questions regarding our WebSockets API bridge (shared)

Yesterday after I published the blog post regarding the WebSockets API bridge (A Silverlight (HTML5) WebSockets bridge up and running!) I got a few questions via email and telephone, as we care so much about WebSockets we share those here.

Q:  What protocol versions does the bridge support?

A: It supports and runs (tested) on –75,-76 (aka draft-ietf-hybi-thewebsocketprotocol-00)  version of the protocol.  As the WebSocket Server of our also deals with “regular-sockets” , we are also able to run those.

Q: How about Mac?

Hmm, yes, as we have been doing this for a while, we have of course made tests at the Mac platform,  Safari for Mac as well as iPhone and iPad do support native WebSockets, it also deals with the Silverlight 4 runtime. So it is not an issue.  We also started the work on a Flash bridge and it is in progress.

Q: The performance of the bridge versus the native WebSockets API?

A: We can see a slight decrease in performance on communication-intensive Websockets implementations (client side)

Q: If we do not run Silverlight?

A: If you don’t run Silverlight or have a WebSocket compliant browser such as Google Chrome , Safari , then you cant use WebSockets , we are working with a Flash bridge ( se above) . There is still options, Of course, you can he a AJAX (http) case back to your real-time web application? But it will not be bi-directional nor as fast as the WebSockets API / Silverlight bridge solution.

Q: Tell me more about the Silverlight bridge, how does it work?

A: Yes, hmm.. It is quite simple, it is a proxy/bridge running at the Silverlight runtime, I consists of a simple JS API that contains a few events, onmessage, onopen,onclose (as WebSockets API) a method for sending (.send(sting)), the JavaScript API, detects and also gives the opportunity to add event handlers to the WebSocket-Message-objects, as well as triggering those events.  Our WebSocket server and its belonging WebSocketHandlers has a Message objects that looks like this (JSON)

 var sampleMessage =
                   
{
                       
event: "MyEvent",
                       
data:
                       
[
                           
{
                               
MyEventArgumentString: "Hello WebSockets everywhere!",
                               
MyEventArgumentInt: 1,
                               
MyEventAgumenttBoolean: false
                           
}
                       
]
                   
};

By using he JavaScript API, you bind event handlers are to those object (messages) by using i.e  myWebSocket.bind(“MyEvent”,fn) no matter if you use native or bridged-Websockets using Silverlight

This is pretty much the concept

 

Magnus

3 kommentarer:

  1. Hi Magnus,

    I am using silverlight pivot for some catalog applications. These would make a lot of sense also on an ipad, where silverlight does not run. Do you think it is possible to port it on html5, with a reasonable effort? Thanks

    fabio (fabio.annovazzi@gmail.com)

    SvaraRadera
  2. Hi, Fabio. Sorry for the late reply. No, im not aware of any "HTML5" ports of the Silverlight Pivot Viewer , and some thing inside me says that we wont see a port of it , as we did with Silverlight Deepzoom. i Assume that you are aware of Seadragon AJAX (http://zoom.it) or http://gallery.expression.microsoft.com/SeadragonAjAX , it deliver Deepzoom experience such as found in Silverlight Pivot. I have seen nice JQuery plugins comining Lightbox and Seadragon AJAX that are "nice.


    It would be possible to build something "like" Silverlight Pivot using such things as mentioned above, it will require som hard work.

    SvaraRadera
  3. Excellent pieces. Keep posting such kind of information on your blog. I really impressed by your blog.

    SvaraRadera