Skip to main content
Known Participant
January 17, 2011
Question

How to send message to direct connected users

  • January 17, 2011
  • 1 reply
  • 3563 views

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 has been closed for replies.

    1 reply

    Participating Frequently
    January 18, 2011
    Known Participant
    January 18, 2011

    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

    Adobe Employee
    January 19, 2011

    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