Facebook Unveils LiveMessage Beta Feature
June 12, 2008
Facebook announced last night the availability of LiveMessage, a new beta feature available to developers. Likely the result of much work put into Facebook’s new chat feature, LiveMessage allows messages to be pushed from one user to another via AJAX.
Unlike the typical HTTP “pull” structure in which the server sends data only when the client requests it, this change will give the appearance as being a “push” structure to the end users. The new LiveMessage wiki entry explains how easy the feature can be implemented. In order to receive messages, a callback handler must be set up in the following manner.
// listen for messages sent with the "game_move" event name
var livemessage = new LiveMessage('game_move', function(data) {
// successfully received a message - "data" is a JSON object.
});
Sending a message is equally easy to implement.
var livemessage = new LiveMessage('game_move');
var data = { from : from_uid, msg : message_text };
livemessage.send(recipient_uid, data);
Given that each LiveMessage is set up with an event name (”game_move” in the above example), it seems that setting up multiple message types would be easy to achieve, simply by providing a separate event name for each.
Clearly, such a unique addition to the Facebook Platform could result in a wave of new types of applications previously unthought of or simply impractical given the technology available.
Comments
Got something to say?



