Hey there, I've been developing a flash app which would allow ppl to make a certain type of node with a fancy graphical interface.
this is step 1 one the project and it went fairly easily, but next steps in the project involve multiple people working on a single piece of content at the same time from within this flash app, with some sort of chat interface so they can communicate with each other.
I've already hooked up my flash app in OG and OG_subgroups for grouping up the people that work on a certain node, made a silly service module that spits out all the users in a certain OG group so the person that starts the node can choose who will be invited to help him.
but my question is the following: is it possible to use the services module (perhaps with a different service than AMF or RPC) to push information from the server to the client, rather than having the client check for updates on a set interval
or would I be better off using a reverse ajax or some long polling ajax thingymajig?
(if any1 is interested in the tiny og_users services module lemme know, it just seems too insignificant and small to throw in contrib)
Comments
red5
Better to look at a Red5 server for things like this.
Server Push
You could look at either Red5 and/or Flash Media Server to accomplish this. This would be a fairly simple task, simple call all connected clients. You could also use a push server, such as Orbited (orbited.org) to accomplish server push (using STOMP for example)
because this is a low budget
because this is a low budget project, I decided to go with a different solution that works with using just a single server
simply made a long polling service by copying the views service and modding it to this:
<?php
function longpoll_service_get($view_name, $fields = array(), $args = array(), $offset = 0, $limit = 0) {
$counter = 0;
while (!$view->result) {
$view = views_get_view($view_name);
$view->set_arguments($args, FALSE);
$view->set_offset($offset);
$view->set_items_per_page($limit);
$view->execute();
$counter++;
if ($counter <20) {
sleep(1);
}
else {
return $view->result;
}
}
if ($view->result) {
foreach ($view->result as $result){
node_tag_new($result->nid);
}
return $view->result;
}
}
?>
making the view only display nodes that have new content, this thing will check once every second for 20 seconds, if no new results are found, it will return an empty result and flash will simply call it again
if it does find a new result, it will mark it as not new anymore and pass it to flash
this way I can use serverside push (sorta), and yet keep the memory usage rather low
I actually extracted the query from the view and put it straight in that function, so it uses even less memory, and then I grouped 2 together to have 1 long polling thread for 2 views, using very little memory