That was exactly what I was looking for! very well put. thanks a ton Pete; i'll try it out.
Austin On 7/7/06, peter royal <[EMAIL PROTECTED]> wrote:
On Jul 7, 2006, at 1:30 PM, Austin Lee wrote: > I have a simple question for which there is probably a simple answer > that I just haven't stumbled upon in the documentation. If I am > running a server with say 1,000 clients, and I want to push a message > to one of the clients, say client#68, how would I go about doing this > using the MINA framework? For instance, if my server is the famous > chat server example, and I wish to send a private message to > client#68, based on an asyncronous request that is triggered by an > outside process (not having every client poll for PMs). You are going to want to maintain your own mapping of client identity -> IoSession's, then its just a matter of getting the IoSession for that client, and calling IoSession.write() ... alternately, you can leverage MINA's mapping that it keeps, using IoAcceptor.getManagedSession(), but you'll need the client's SocketAddress then to do the lookup. I'd implement it like this: * in your IoHandler register the client's IoSession once you have established the client's identity with your own registry * have a thread/task that monitor's a Queue for things-to-send-to- clients * the above will read off the thing to send, look up the client's IoSession based up on the identity that the message contains * IoSession.write() out the message to the client -pete -- [EMAIL PROTECTED] - http://fotap.org/~osi
