tags:

views:

48

answers:

2

I have to interact with a legacy system that accepts socket communication and messages. My goal is to make the application cross-platform, but I need the ability to push messages to the client (i.e. - .NET's WCF, Java's Comet) and detect when the user closes out of their browser to destroy the socket. I have built a prototype of .NET wrapper + WCF + Silverlight but it is so disconnected it is difficult to manage the state of the user and seems to be a nightmare to support. All of that considered, what would be my best option?

+2  A: 

HTTP is stateless. You need to maintain a session for each user (which is usually done with HTTP cookies.) Then, depending on how flexible the legacy system is, you might maintain a pool of connections to it, mapping connection to session on demand, to balance load on that legacy system.

Nikolai N Fetissov
A: 

If you need to push information to the client, I'd suggest you use Silverlight or Java applet and make a socket connection. Comet or iframe long polling are hacks. They're not reliable. Or, if you can wait, use WebSocket, which is now independent from HTML5 and, gods know when it will become the standard.

shinkou