Archived entries for Flex

Facebook Connect to Actionscript 3

Facebook has launched Facebook Connect a little more than a month ago and it has seen a major adaptation on the Internet now. We’ve seen it in action on TechCrunch, Digg, Vimeo and a dozen of other sites. Together with Google Friend Connect (and maybe MySpace Data Availability) it announces a time of one social profile on multiple sites with features like friend linking, profile information exchange and bunch of easy tools for content sharing (on Facebook for instance).

At Proximity BBDO, we try to make user integration and participation on campaign sites as easy as possible and just hitting the ‘Connect with Facebook’ button is easy. I’ve been working on a bridge to link the Javascript implementation of Facebook Connect to a Flash or Flex site.

An example of a Facebook Connect Flash application can been seen here. It currently supports automatic login, retrieving friend list and friend information (can take a while), current application users, sharing a link on Facebook, posting a predefined story and updating your story (make sure you set the status permissions first).

Example of the Facebook Connect Bridge

I have deliberately chosen to fully implement the results in Flash rather than merely providing a wrapper for the Javascript calls and dealing with the result in Flash itself. At the moment I’m of course limited to the things I program in Flash (the calls and the results).
But as we have to deal with automatic login and javascript popups, this way was easier to integrate in a Flash website and, moreover, the Javascript library is built with a HTML website in mind. So, it allows you to use the same library in your average website and listen to any event that passes along (login, disconnects, friends, a status that has been set, …)

Update: I have included the inviting of friends as well. They will receive an invitation for the application in their Facebook inbox. One downside, at the moment, is that there is a redirect after successfully inviting friends. I’m still working on fixing that.

Update 2: The code library is available at github.com as project FBFlashBridge.

RTMPT problems with WebORB in as3

At Proximity BBDO we’ve been working on a nice case for Belgacom: Internet is mine! (Mine I tell you!) You can claim the internet by simply pushing a button: that’s it, you’re now the owner of the internet .. until someone else claims it. The switching between owners is going fast, very fast.

So, what did we use to accomplish the real-time interaction between visitors? Right, some push technology delivered by Red5, Flash Media Server or WebORB, to name a few. We used WebORB .NET from The MidnightCoders for our project, it has a tight integration with our existing .NET working environment and allowed direct communication with our SQL databases.

The first tests we did were pretty neat, a hundred connections and constant pushing (figuratively and literally speaking) were being processed without a flaw. But as the application grew more complex and a lot of database interaction happened at each click/push we encountered some hiccups now and then; traffic congestion, time-outs and just general slowness.

One of the reasons, was are choice of transfer protocol. At first we used rtmp as a protocol but our experience with other projects was that rtmp (defaults at port 1935 and for WebORB port 2037) gets blocked by corporate firewalls leaving a part of the visitors out of the fun. So we directed all traffic to port 80 and so changing the protocol to rtmpt. And this seemed a bad idea.

  • Speed is considerably lower on rtmpt than on rtmp.
  • Packets being sent are larger as they contain additional HTTP headers

So, after problems raised we had to change everything back to normal. Rtmpt wasn’t a valid choice in this situation as we required real-time push from client to server and server to client for hundreds of connections. The bad news now, is that probably some users won’t be able to participate on the website. But thus far we haven’t received any complaints (thank god).

So, consider all down-sides before choosing the more ’safe’ rtmpt protocol over rtmp. I warned you, so don’t come crying afterwards :)



Copyright © 2004–2009. All rights reserved.

RSS Feed. This blog is proudly powered by Wordpress and uses Modern Clix, a theme by Rodrigo Galindez.