Hi guys i am trying to run application.gc on disconnect of all users. [q] application.onDisconnect = function(client){ trace("disconnect: " + client.name); application.users_so.setProperty(client.name, null); if (application.clients.length < 1){ application.gc(); applications.shutdown() } } [/q] gc never seems to trigger and if i run a trace it returns false. Anyone
I did view the docs before posting.
yeah its server side action script that runs the garbage collection and since its collecting and disposing of server garbage it has no data to return it just simply cleans up. what exactly are you trying to do?
right ok that makes sense. But it would seem that it is not clearing up the garbage. i have been building simple textchat with fms, i am sure you have seen the example files. When the last person leaves a room i then run amfphp to save history to mysql db. This is working fine but if a user re-enters the chatroom after leaving then there is still the previous chat history from the SSO and again when he leave this history is added to the db. so it is kind of a duplicate entry into the db. If i could run the gc() after the last user has left the chat room then when he/she re-enters there should be a clean sheet. This is not the case. I can still see the SSO in the FMS admin console. thanks for any help
oh well why didn't you say so make the shared object non persistant then when the user disconnects write null to the shared object .....something like...SO.data.slot1 = null; heck you could even clear the shared object every few minutes sure they wouldn't be able to scroll back up and read after the text clears but at least you won't double write or you could just copy the text into a second remote shared object and use that to write to your database and after it writes to the database it clears its self thereby leaving the text chat history intact.
heck appstop might even help you clear that crap.
sure I can explain more a remote shared object does nothing more than hold data so when you are done using the data then clear the remote shared object the easiest way to clear it is to pass null to the remote shared object which tells it data doesn't exsist in the remote shared object or you can pass double quotes SO.data.slot1 = " "; to it also which is the same as passing null.If you want to pass the contents of a dynamic text field into two objects you would just write.... SO.data.slot1=mytext.text; SO.data.slot2 = mytext.text;
Would this be the correct code to clear the SSO? [q] save_history.prototype.isHistory_Result = function(result){ application.users_so.setProperty(null, null); application.shutdown(); } [/q] ? thanks
those 2 links you posted in a previous post and dont help my situation and have nothing to do with SSO
I guess I don't understand how you are writing to the database sorry I was just putting in my two cents.........I write to my database using php so maybe what I said above isn't relevent to your situation and you should repost this question....or give your code a try untill you succeed.
All i want to do is when the last user has left the room trigger a function of some sort to clear the SSO so that in the off chance that the user decides to go back into the room a minute later the previuos conversation is gone. So i need to clear the SSO but i dont know how to do that.
save_history.prototype.isHistory_Result = function(result){ application.users_so.clear(); application.shutdown(); }
neither has worked. :( i tried to do a trace but nothing is returned [q] application.onDisconnect = function(client){ trace("disconnect: " + client.name); application.users_so.setProperty(client.name, null); if (application.clients.length < 1){ var names = application.users_so.getPropertyNames(); for (k in names){ var propVal = application.users_so.getProperty(names[k]); trace("Value of property " + names[k] + " = " + propVal); } save_history(); } } [/q]
keep tring maybe do something else untill you become a master with server side scripting .....you know do simple stuff and work your way up sounds like what you want to do is pretty complex so simplify your sever side scripting projects for a few days.
[q][i]Originally posted by: [b][b]calmchess333[/b][/b][/i] keep tring maybe do something else untill you become a master with server side scripting .....you know do simple stuff and work your way up sounds like what you want to do is pretty complex so simplify your sever side scripting projects for a few days.[/q] Ha ha great minds think alike :) Just spent the day building theCMS for the chatroom today.
Don't see what you're looking for? Try a search.
|