views:

61

answers:

1

I have been thinking about building a client to client program. But the way I want is to use the broswer to do it, helped by a server that can make that connection.

The troubles comes when I need to have an unnconected socket (or pasive) in a client, waiting for a connection.

I have been thinking about Html5 WebSockets, but it doesn't give to the client the posibility of having a pasive socket without connecting it with a TCP protocol.

I'm learning this and trying to find the way to do this. All ideas are wellcome :D.

A: 

You can have a passive socket in Java applets, Flash and other browser plugins, but in general that can be problematic for public web applications.

First of all it will be difficult to get through firewalls, etc, and you'll need to depend and write code for a browser plugin that implements a socket API, and bridge it to JavaScript. If you are interested in some solutions, you may want to check out the following Stack Overflow post:

The traditional approach for peer-to-peer communications between browsers is to have your server acting as a gateway for all the connections. Browsers initiate the connection (either with WebSockets or with XMLHttpRequest) and keep an active connection to the server at all times, re-establishing it if it drops. Since the server application will always find an open TCP connection to all the connected browsers, it can easily route messages to/from all clients.

Daniel Vassallo
thx for the answer , anyway what i wanted was not use plugins . But you tell me what i think , there isnt a good way without a browswer plugin bridge.
Angelus