Subj : Re: Queues vs. Sockets To : Digital Man From : X V Lxxix Date : Fri Jun 20 2008 07:34 am > Re: Re: Queues vs. Sockets By: Digital Man to X V Lxxix on Thu Jun 19 2008 01:02 pm > > Re: Re: Queues vs. Sockets > By: X V Lxxix to Digital Man on Thu Jun 19 2008 12:46 pm > > > > > Both (either one) of these fixes forces the Queue destructor to be > > > > called at the end of the script which is responsible for detaching > > > > the node thread from the Queue and removing the Queue from the > > > > named-queue list. > > > > > > that worked. I think part of the problem was that to make the queue > > > communications work for more than 2 people, I had to create more than > > > one queue, and consequently each participating user had to create a > > > local instance of each named queue. > > > > > > It made things a lot harder to clean up. Since you have a local > > > instance of every user's queue, you can't rely on the queue's > > > existence to determine if the user is still present. so I had to make > > > an exiting user broadcast on a named "quit" channel so that listening > > > connections would know the person has left, and both would have to > > > delete their instance of the queue. > > > > > > Somewhere in that nonsense things did not work. > > > > Glad it's working for you now. In general, it's good practice to use > > 'var' to define variables as the scope is then specified (not global) > > and you'll have better garbage collection. > > BTW, I realize it's probably not clear from the documentation > (http://synchro.net/docs/jsobjs.html#Queue), but the "value" argument to > the Queue.write() method can be any of several JS value types: bool, > string, number, null, *even* an object (with properties of any of these > types, including nested objects). > This may help in passing complex state information between threads (nodes) > without requiring complex string parsing. VERY good to know. For some reason I was under the assumption that was not the case. I think I tried passing an object and it didn't work. But....... I've been known to pull on the "push to open" doors. .