Reputation: 10509
Is it possible to bind to a socket with in-browser javascript code? I need to open a local web server when a user visits a page to provide some localhost web publishing.
Upvotes: 1
Views: 926
Reputation: 7941
you cannot listen on a port with websocket so you cannot create a local web server within a browser.
Do websockets allow for p2p (browser to browser) communication?
But you can create javascript server with Nodejs. This is also javascript, but not in the browser. This is easy, fast and lightweight.
(i guess) javascript, silverlight, flash cant create in-browser server. they cant access to the sockets directly. the browser not allows. i think the websockets are forwarded sockets by the browser. also i dont really understand why you want to create this.
Upvotes: 1
Reputation: 47776
Modern browsers can use WebSockets, though it has it's own protocol. Otherwise, there are solutions out there that use a hidden Flash object to do TCP sockets. One of them is jsxmlsocket.
Upvotes: 1