Search code examples
javascriptwebserver

Bind to socket using javascript?


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.


Solution

  • 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.