views:

293

answers:

5

I am creating firefox extension. I need to use sockets. I need it to work over http protocol. Is there any javascript library for creating http sockets. Communication is peer to peer so I need client socket and server socket in javascript it need to work over port 80 so it must follow http protocol.

+1  A: 

No

Sockets need to be implemented by the OS and providing a Javascript interface to creating sockets would be an enormous security issue.

You can't have a web-application that listens for incoming connections. You can only initiate HTTP connections outwards.

Ben S
A: 

You might need your Firefox extension to use an external DLL to do the socket work for you.

However, you're saying you need to do "HTTP". Can't you use XmlHttp instead of pure sockets?

Ates Goral
A: 

No, you can not do use sockets in Javascript.

I'm pretty certain you'll have to use Flash or similar as a bridge to create the socket.

Bryan Denny
+1  A: 

You can't.

However you can use the same techniques used with AJAX to create a HTTP connection with a remote server.

Spencer Ruport
A: 

I found one http://jslib.mozdev.org/libraries/network/network.html

Xinus