One more question about publications...

59 views
Skip to first unread message

Robert Tarasov

unread,
Mar 11, 2013, 3:55:43 PM3/11/13
to openrtmf...@googlegroups.com
Hello,

I have one more question about publications. For example, I want to provide two way communication between  server and client using publications. So, I have to create two publication:

1. On client side:
[...]
_sendStream = new NetStream(_connection.connection);
_sendStream.addEventListener( NetStatusEvent.NET_STATUS, OnSendBufferEvent );
_sendStream.dataReliable = false;
_sendStream.publish(_connection.userName,"live");
[...]

2. On server side:
[...]
respPub = cumulus:publish(respPubName);
[...]

After that I have to create one more stream on client side to receive the data from the client:

[...]
_recvStream = new NetStream( _connection.connection);
_recvStream.addEventListener( NetStatusEvent.NET_STATUS, OnRecvBufferEvent );
var recvProc : Object = new Object();
recvProc.OnRecvData = OnRecvData;
_recvStream.client = recvProc;
_recvStream.play( pubName );
[...]

And here is a OnRecvData function to process a data received from the server:

[...]
private function OnRecvData(data:String) : void {
trace( "Data received from [] " + data.length + " bytes" );
        }
[...]

Also, I add this code to the server side to process client's data

function onDataPacket(client, publication,name,packet) 
[...]
respPub:pushDataPacket("OnRecvData ", "blah-blah");
respPub:flush();
[...]
end

So, I receive all the data on server side (from client), but I can't receive anything from Server to Client using backward publication. In other words, OnRecvData function never calls on client. All stream initialization processes without any error and I receive NetStream.Play.Start events. Am I doing something wrong?


Thank You!
Reply all
Reply to author
Forward
0 new messages