[Laszlo-user] Using Red5 for pushing Data from Server to WebApp

Anze Cesar anze.cesar at gmail.com
Fri Mar 21 07:07:51 PDT 2008


On 3/12/08, Anthony Bargnesi <abargnesi at gmail.com> wrote:
>
> Tobias,
>
> Yes this is possible with Red5 and OpenLaszlo.  Go to this wiki page<http://wiki.openlaszlo.org/RtmpRed5Webapp>and try the example war.  This page also outlines some bugs in OpenLaszlo
> that need fixing in order to support Red5 fully, but it has been working
> fine for server - client communication.
>
> Here is an example open laszlo file:
>
> <canvas debug="true">
>     <button name="callButton" onclick="sendEventCall();">
>         Call sendEvent
>         <method name="sendEventCall">
>             canvas.rtmp.sendEvent.event = "button was clicked!";
>             canvas.rtmp.sendEvent.call();
>         </method>
>     </button>
>     <rtmpconnection name="rtmp" debug="true" autoconnect="true"
> src="rtmpt://192.168.1.134:80/cardsrvr/myhome' }" >
>         <handler name="onconnect">
>             Debug.write("connected");
>         </handler>
>         <handler name="onerror">
>             Debug.write("error ",this.status);
>         </handler>
>
>        <netremotecall name="sendEvent" funcname="sendEvent">
>             <attribute name="event" value="" type="string" />
>             <netparam name="vars1"><method name="getValue"> return
> parent.event;</method></netparam>
>         </netremotecall>
>
>        <netremotecall name="newEvent" funcname="newEvent">
>             <method name="onResult" args="value">
>                 Debug.write('event received: ' + value);
>             </method>
>         </netremotecall>
>     </rtmpconnection>
> </canvas>


What you've presented here are mthods to be called on the serverside
afaik and will thus not eliminate the problem of polling.
What you in fact want is a function to be called by the server.

You can achieve this within the init method of rtmpconnection with
something like:

this._nc.rejected = function(reason) {
Debug.write("rejected: ", reason);
}

and it then gets called as you've suggested (((IServiceCapableConnection)
conn).invoke("rejected", new Object[] {"Because I can..."}); :)

-- 
lp,
Anže
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20080321/371b113a/attachment.html


More information about the Laszlo-user mailing list