Skip to main content
Known Participant
Jan 17, 2011 2:41 PM UTC
Question

How to send message to direct connected users

Hi,

I am working on a text Chat application with FMS4 "RTMFP" connection and i am looking a functionality to send direct message to one to another peer, please some one help me.

Thanks

Sushil

    This topic is closed to new replies. Start a new post to keep the conversation going.

    6 replies

    Participating Frequently
    Jan 18, 2011 5:25 AM UTC
    Known Participant
    Jan 18, 2011 10:31 AM UTC

    Hi,

    thanks very much,

    i have gone through that link, but my requirement is not exactly same but similar  to that.

    suppose within group 10 member are connected and you are looking send message to 5 no. member then how will you send to him.

    Thanks
    Sushil

    Translate
    Adobe Employee
    Jan 19, 2011 6:59 PM UTC

    Below are the lines from above link which you can use for your purpose if your users are directly connected.

    Sending Message

    // peer2ID is of #2 (Moscow)
     
    var message:Object = new Object();
    message.destination = netGroup.convertPeerIDToGroupAddress(peer2ID);
    message.value = "Hello I am message from #1";
     
    netGroup.sendToNearest(msg, msg.dest);

    Receiving Message
    When you receive a Direct Routing message, it comes to NetStatusEvent with code “NetGroup.SendTo.Notify”:

    netGroup.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
     
    function netStatus(event:NetStatusEvent):void{
         switch(e.info.code){
         case "NetGroup.SendTo.Notify":
              // e.info.message contains our message Object
              trace("Received Message: "+e.info.message.value);
              break;
         }
    }

    But this will work only if #2 is a neigbor of #1.

    So if it is not directly connected use forwarding.

    Regards,

    Amit

    Translate