Skip to main content
Participant
May 5, 2010
Question

How to call a particular client through FMS

  • May 5, 2010
  • 2 replies
  • 576 views

Hello Friends

                     Can Anybody guide me how to call a particular client from fms.

Actually i m making a private chat application in which text messg send from one client to another specific client through FMS.

So i m confused how gms recognize a particular clients.I am avoiding application .client[] array that contains all the connected users references.

becoz it changes at the time of connection and disconnection of client from fms.

So please guide me how to call a particular one from client.please help me out i m working on this from past 5 days but could not get any idea.

Thanks And Regards

   Vineet Osho

    This topic has been closed for replies.

    2 replies

    Janaki Lakshmikanthan
    Adobe Employee
    Adobe Employee
    May 6, 2010

    You can also use Shared Object send method to send the new data to the clients connected to one chat room. I am not sure if you have tried this sample app - http://www.adobe.com/devnet/flashmediaserver/articles/rmi_fms2_03.html

    Adding to Jay's reply... You can add unique query string to identify each and every user. This is added to the connection URI like nc.connect("rtmp://myserver/myapp/myinstance?myindentifier=myusername"); using client.uri, you can get the query string 'myindentifier=myusername' and call the right client.

    Regards,

    Janaki L

    May 5, 2010

    In order to target a specific client, you need to have a reference to that client.

    What I typically do is assign a unique id to each client as they connect:

    application.onConnect = function(client){

    client.uid = "somethinguniquehere"

    }

    and then provide a list of those UID's to all of the clients (often with a shared object).

    When a client sends a message that is to be targeted to another client, the sending client includes the UID in the request, and then I loop through the application.clients array to find the client with the right UID

    client.sendSomething = function(client, uid, message){

    for(var a=0; a<application.clients.length; a==){

    if(application.clients.uid == uid){

    application.clients.call("receiveSomething", null, message);

    }

    }