Skip to main content
Known Participant
February 9, 2007
Question

simple textchat

  • February 9, 2007
  • 7 replies
  • 716 views
For the life of me i cant find the SO for the simple chat app sample.

I have modded it and have 4 rooms
To connect to a room my rtmp is:
client_nc.connect("rtmp:/" + mpt + "chat/" + result_lv.roomID, _global.myName);

On the server i have
applications/chat/main.asc
applications/chat/1/
applications/chat/2/
applications/chat/3/
applications/chat/4/

So i am presumming that the SO will be stored in each of these folders.

This dosn't seem to be the case.
The SO is definetly being stored somewhere because when i leave and enter go back into the room the text is there.
I reload the full site go back inot the room the text is there.
i have also checked locally with no SO found.

Anyone.
    This topic has been closed for replies.

    7 replies

    Known Participant
    February 12, 2007
    I think i am getting that error because i am using FCS not FMS.
    I would presume that the same function would work in either?
    Known Participant
    February 10, 2007
    quote:


    \applications\chat\main.asc: line 36: TypeError: application.shutdown is not a function

    February 10, 2007
    Not sure why you're getting the TypeError... application.shutdown is a valid function:

    http://livedocs.macromedia.com/fms/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?href=00000664.html

    About the app still showing a client when there isn't one... it's because the server didn't detect the disconnect. That's a fairly common problem. I like to solve it by having each client call a function on the server every 5 seconds which updates a timestamp in an array. Every 10 seconds, the server loops through the array and chacks for clients that haven't updated in the past 10 seconds. If one is found, application.disconnect is called on that client.


    February 9, 2007
    Something like this:

    application.onDisconnect(clientObj){
    if (application.Clients.length < 1){
    application.shutdown();
    }
    }

    When the last client leaves, the app will shut itself down, and your temp SO's will be gone. You'll know it worked when the app disappears from the admin console.
    Known Participant
    February 10, 2007
    Ok here's what i have.
    application.onDisconnect = function(client){
    trace("disconnect: " + client.name);
    application.users_so.setProperty(client.name, null);
    if (application.clients.length < 1){
    application.shutdown();
    }
    }
    That app dosnt disconnect.

    Looking at the app inpsector it show 2 peeps connected
    Then when i disconnect it still shows 1 peep as connected.

    Any ideas?
    Known Participant
    February 9, 2007
    ok the so is temp. Is that why i can actually see it?
    How do i make it stored?
    February 9, 2007
    Okay... let's make sure the SO is temporary so we can be sure it's not a server error.

    With the app running, look at the shared objects panlel in the admin console and see if the SO is marked as stored or temp.

    If it's marked as temp, the data will clear when the application shuts down. If you haven't programmed your SSAS to shut the app down when the last client disconnects, it won't shut down until the server runs garbage collection (not sure how long that takes, I personally don't wait for the server to take care of things when I need them done).

    If the SO is marked as temp, unload the app, and the next time you connect the SO data will be gone.

    If it's marked as stored, search the drive for [SharedObjectName].fso and see if it's ending up somewhere it shouldn't be.
    Known Participant
    February 9, 2007
    quote:

    SSAS to shut the app down when the last client disconnects


    How do i do that?
    or even if oyu can tell me how to see a trace from the main.asc file?

    thanks

    I am reading the book! Honest!
    Known Participant
    February 9, 2007
    Thats what i thought but the shared object is definetly not there.
    February 9, 2007
    FSO files (the shared object files) will be stored here:

    applications/chat/SharedObjects/instanceName/sharedObjectName.fso

    If your shared object is persistent, the file will be there. IF the SO is not persistent, it will be removed when the application shuts down.