Tobias,<br><br>Yes this is possible with Red5 and OpenLaszlo. Go to <a href="http://wiki.openlaszlo.org/RtmpRed5Webapp">this wiki page</a> 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.<br>
<br>Here is an example open laszlo file:<br><br><canvas debug="true"><br> <button name="callButton" onclick="sendEventCall();"><br> Call sendEvent<br> <method name="sendEventCall"><br>
canvas.rtmp.sendEvent.event = "button was clicked!";<br> canvas.rtmp.sendEvent.call();<br> </method><br> </button><br> <rtmpconnection name="rtmp" debug="true" autoconnect="true" src="rtmpt://192.168.1.134:80/cardsrvr/myhome' }" ><br>
<handler name="onconnect"><br> Debug.write("connected");<br> </handler><br> <handler name="onerror"><br> Debug.write("error ",this.status);<br>
</handler><br><br> <netremotecall name="sendEvent" funcname="sendEvent"><br> <attribute name="event" value="" type="string" /><br>
<netparam name="vars1"><method name="getValue"> return parent.event;</method></netparam><br> </netremotecall><br><br> <netremotecall name="newEvent" funcname="newEvent"><br>
<method name="onResult" args="value"><br> Debug.write('event received: ' + value);<br> </method><br> </netremotecall><br> </rtmpconnection><br>
</canvas><br><br>This will connect to a red5 rtmpt (http tunneling) connection with the rtmpconnection tag. Then when the button is clicked<br>the netremotecall tag named "sendEvent" is used to call the server's endpoint. The ApplicationAdapter class which is the<br>
server handler for a particular context is used to call into (from client - server) and call out of (server - client).<br><br>public class Application extends ApplicationAdapter implements IPendingServiceCallback {<br> private static final Log log = LogFactory.getLog(Application.class);<br>
<br> public boolean appStart() {<br> log.info("Application.appStart");<br> return true;<br> }<br><br> public void appStop() {<br> log.info("Application.appStop");<br>
}<br><br> public boolean appConnect(IConnection conn, Object[] params) {<br> log.info("Application.appConnect " + conn.getClient().getId());<br> return true;<br> }<br>
<br> public void appDisconnect(IConnection conn, Object[] params) {<br> log.info("Application.appDisconnect " + conn.getClient().getId());<br> }<br><br> public String sendEvent(String event) {<br>
try {<br> log.info("Method 'sendEvent' called with: " + event);<br><br> IConnection current = Red5.getConnectionLocal();<br><br> Iterator<IConnection> it = current.getScope().getConnections();<br>
while (it.hasNext()) {<br> IConnection cons = it.next();<br> if (cons instanceof IServiceCapableConnection) {<br> ((IServiceCapableConnection) cons).invoke("newEvent", new Object[] { event }, this);<br>
}<br> }<br> } catch (Exception err) {<br> log.error("invokeClientFunctions", err);<br> }<br> return event;<br>
}<br><br> public void resultReceived(IPendingServiceCall call) {<br> try {<br> log.info("resultReceived "+call);<br> log.info("resultReceived Arguments "+call.getArguments());<br>
log.info("resultReceived Arguments Number "+call.getArguments().length);<br> log.info("resultReceived Result "+call.getResult());<br> log.info("resultReceived ServiceMethod Name "+call.getServiceMethodName());<br>
}<br> catch (Exception err) {<br> log.error("resultReceived",err);<br> }<br>}<br><br>Hope this helps. A good start would be to check out the example war.<br><br>-Anthony Bargnesi<br>
<br><div class="gmail_quote">On Wed, Mar 12, 2008 at 10:09 AM, Tobias Wolf <<a href="mailto:tobias.wolf@evision.de">tobias.wolf@evision.de</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
i just want to know if this is possible.<br>
<br>
What i want to accomplish is an application that gets updated from the<br>
server without the need to poll every second, but it should connect<br>
itself and when wait for new data. Once the server has send new data a<br>
ondata function gets called, or better, a dataset gets updated and the<br>
application can show the new data.<br>
<br>
Is this possible with OpenLaszlo and Red5 ?<br>
<br>
The only other chance for doing something like this is the Flash<br>
XMLSocket, but since i already want to use the Red5 Server for media<br>
streaming i thought, maybe he can do both and i don't have to deal with<br>
two different instances for managing data.<br>
<br>
Thx in advance,<br>
<br>
--<br>
<font color="#888888"><br>
Tobias Wolf<br>
<br>
<br>
<br>
</font></blockquote></div><br>