1

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.

2
  • en.wikipedia.org/wiki/WebSocket Commented Dec 19, 2011 at 19:56
  • @omnosis - thank you, this is a very important point, that WebSockets only allow outbound connections. I will go ahead and use Silverlight to host an in-page localhost-available web server. You should post your comment as an answer. Commented Dec 19, 2011 at 21:08

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

This is always the point. Every good "not-yet" implemented idea rises reaction of a form "I don't know why would you want to implement it", when inquiring about thechincal realization. Silverlight can bind to a socket, javascript with flash can do to.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.