Hi Parki, On Nov 13, 2007 7:34 AM, parki <[EMAIL PROTECTED]> wrote: > > One further question: > > Once the SSL stuff gets figured out, I have one more issue with respect to > long running connections - we want to use a long running connection over > HTTPS, and send/receive messages asynchronously. In other words, the client > is not always initiating the request (although it will initiate the > connection at the start) so we can push data in either direction. We own the > client and server, so we intend to use the client-initiated HTTPS connection > as a two way chat. > > I am currently using a StreamIoHandler to handle the connection, but the > problem now is that there will be one thread per socket connection, unless I > layer NIO stuff on top of this and use a selector instead of blocking on > read or polling. > > I'm happy to do that, but it seems that I might be missing something here - > there may be a mina-centric way of doing something like this.
You could take a look at the AsyncWeb in our sandbox (http://svn.apache.org/repos/asf/mina/sandbox/asyncweb) or refer to the simpler HTTP server example at org.apache.mina.example.httpserver.codec. These don't use StreamIoHandler so one thread can handle multiple connections, which means optimal resource consumption. > I hope this makes sense - in a nutshell, we want HTTPS connection initiated > from the client (to get out through the firewall) and then set up a > long-running connection and push encrypted data back and forth. Yes, it makes a lot of sense, and that's why other web application servers are trying to add similar features. HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
