Hi,

I have a problem with arrays in combination with RTMP, and I can´t report it
on the Trac, because I have a very limited connection to the net:(

The array sent by Flash-RTMP is converted in an unsorted object and is
returned as the first element of an unknown array (codes are attached as
text at the end of this mail). 
The same array sent by Flash-AMF returns a correct array as expected.

(testfiles: is it allowed to send the testfiles as attachment (60K)? 

// RESULT FROM RTMP: buggy result (*1)

>>>echoArray result type is Array? true
 {array #1}
        [0] {object}
                1: 1 {number}
                6: 6 {number}
                8: 8 {number}
                4: 4 {number}
                9: 9 {number}
                0: 0 {number}
                2: 2 {number}
                7: 7 {number}
                5: 5 {number}
                3: 3 {number}
---------------------------
>>>echoList result type is Array? true
 {array #1}
        [0] {object}
                1: 1 {number}
                6: 6 {number}
                8: 8 {number}
                4: 4 {number}
                9: 9 {number}
                0: 0 {number}
                2: 2 {number}
                7: 7 {number}
                5: 5 {number}
                3: 3 {number}
---------------------------

// RESULT FROM AMF: correct result (*2)

>>>echoArray result type is Array? true
 {array #10}
        [0] 0 {number}
        [1] 1 {number}
        [2] 2 {number}
        [3] 3 {number}
        [4] 4 {number}
        [5] 5 {number}
        [6] 6 {number}
        [7] 7 {number}
        [8] 8 {number}
        [9] 9 {number}
---------------------------
>>>echoList result type is Array? true
 {array #10}
        [0] 0 {number}
        [1] 1 {number}
        [2] 2 {number}
        [3] 3 {number}
        [4] 4 {number}
        [5] 5 {number}
        [6] 6 {number}
        [7] 7 {number}
        [8] 8 {number}
        [9] 9 {number}
---------------------------


QUESTION: 

By this way, I have one questions.

Is have tried to send some complex Domain-Models to Flash. 
With success. But if one of the Domain-Models properties is an enum, Flash
crashes. Is it possible to support enum's-Conversion in Red5-RTMP and
Red5-AMF? I would like to send detached Hibernate-Objects to Flash without
using DTO´s (no need for DTO´s, because Flash needs all objects in the
objectgraph)... This is not possible, if an enum property is used, so I have
to rewrite my Domain-Objects


OFFTOPIC QUESTION: 

I have also two offtopic questions.

How do you expose your domain-models to Flash (RTMP, AMF, FLASHORB, SOAP,
pure XML)?   

And how do you convert Flash-Classes in Java-Classes without hand-coding?
One way is to use XML and Apache Betwixt... There is maybe a more efficient
way for this Problem. Please give me some tips. Thank you all.



Sorry for this Multi-Topic-Mail :) 

Bye,
Hassan Beigi







// FLASHCODES

just replace the uri-path in the sourcecode. 
i use red5 0.5 final release and the test application without any changes.
see also org.red5.samples.services.EchoService)



*1)
arrayEchoTestRed5RTMP.fla
---------------------------
uri = "rtmp://Mega180/test";

// SOS ist just a trace-class; analyse the results with the flash
debuggerSOS.initialize ();
SOS.setMode (2);
SOS.clear ();
nc1 = new NetConnection ();
nc1.connect (uri);
nc1.onStatus = function (info) {
        if (info.code=="NetConnection.Connect.Success") _root.testStep0();
}
testStep0 = function () {
        resultObject = {
                onResult: function (result) {
                        trace (">>>echoArray result type is Array? "+(result
instanceof Array));
                        SOS.trace (result);
                        testStep1();
                }
        }
        nc1.call ("echo.echoArray", resultObject, [0,1,2,3,4,5,6,7,8,9]);

}
testStep1 = function () {
        resultObject = {
                onResult: function (result) {
                        trace (">>>echoList result type is Array? "+(result
instanceof Array));
                        SOS.trace (result);
                        testStep2();
                }
        }
        nc1.call ("echo.echoList", resultObject, [0,1,2,3,4,5,6,7,8,9]);

}


*2)
arrayEchoTestRed5AMF.fla (place RemotingClasses and RemotingDebugClasses in
your flash library: Window->Common Libraries->Remoting - drag and drop both
items to your library)
-------------------------
uri = "http://Mega180:5080/test/gateway";;

import mx.remoting.*;
import mx.rpc.*;


// SOS ist just a trace-class; analyse the results with the flash debugger
SOS.initialize ();
SOS.setMode (2);
SOS.clear ();
service = new Service (uri, null, "echo");

testStep0= function () {
        echoArray_Result = function (result) {
                result = result.__result;
                _global.result0=result;
                trace (">>>echoArray result type is Array? "+(result
instanceof Array));
                SOS.trace (result);
                testStep1();
        }
        var pc:PendingCall = service.echoArray ([0,1,2,3,4,5,6,7,8,9]) ;
        pc.responder = new RelayResponder (this, "echoArray_Result", null);
}
testStep1= function () {
        echoList_Result = function (result) {
                result = result.__result;
                _global.result1=result;
                trace (">>>echoList result type is Array? "+(result
instanceof Array));
                SOS.trace (result);
        }
        var pc:PendingCall = service.echoList ([0,1,2,3,4,5,6,7,8,9]) ;
        pc.responder = new RelayResponder (this, "echoList_Result", null);
}

testStep0();



_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to