Skip to main content
January 11, 2007
Answered

Managing client's streams

  • January 11, 2007
  • 1 reply
  • 307 views
I have found that I should be able to create a folder for a client on connect. then, I'll save audio recordings to that folder during a session and delete the folder on disconnect.

I need to create a unique folder name for each user. I thought of using their login email address, but that isn't an ideal format for a folder name! Alternatively, I thought of using the user's first and second name, but there's a risk that the name won't be unique.

I see that the FMS2 creates a unique client ID on connect but I can't see any way of using that in actionscript. I don't see anything in the Client class to provide me with the client ID. Can anyone tell me if I can use this Client ID in my actionscript so I can use it to create a folder?

Thanks in advance.
    This topic has been closed for replies.
    Correct answer
    var client_id = 0;

    application.onConnect = function(clientObject) {
    client_id++; // add 1 to the global variable
    clientObject.id = client_id; // assign the unique global var/id to this client

    // do stuff with clientObject.id like sending the ID to the client and let the
    // client publish a stream with this ID, which is unique for each new connect...


    }

    1 reply

    Correct answer
    January 12, 2007
    var client_id = 0;

    application.onConnect = function(clientObject) {
    client_id++; // add 1 to the global variable
    clientObject.id = client_id; // assign the unique global var/id to this client

    // do stuff with clientObject.id like sending the ID to the client and let the
    // client publish a stream with this ID, which is unique for each new connect...


    }
    January 12, 2007
    Thanks. That's a really obvious way of doing it and I think I should be more aware that FMS scripting is much more like client-side scripting than I had previously thought!

    Simon.