Take the 2-minute tour ×

Possible Duplicate:
How to make a browser to browser (peer to peer) connection?

I'm planning on making a multiplayer game web game, and it would be awesome if it worked over lan (since it's faster and I want people, that play together, to sit in the same room.)

The idea is that each client is a webpage, one of them is the master, which all others connect to (the others don't have to communicate with each other.) Each client also is a webpage.

So now I was wondering, are there any javascript libraries out there that can do this? Connecting computers over lan, without the need of an internet connection (other than actually loading the webpage.)

I saw some older answers which didn't help much, so maybe there's something new that can help me?

share|improve this question

marked as duplicate by GolezTrol, Quentin, Clyde Lobo, Macmade, amon Sep 16 '12 at 20:59


I don't think browser javascript exposes any functionality to create listening sockets. –  lanzz Sep 16 '12 at 13:30
You'd still need an apache/similar server. –  hjpotter92 Sep 16 '12 at 13:30
I have no idea about javascript libraries, but have you ever came across nodejs.org ?? –  Avinash Sep 16 '12 at 13:34
You still need a server, which you cannot setup in a browser. I think this question shows a severe lack of understanding of such technologies, and proceedings this way will likely result in a disappointing experience. Pick a project that is a little easier to get started and learn before building an in-browser javascript served MPORPG. –  GolezTrol Sep 16 '12 at 13:38
I'm not building an rpg, much simpler. Something similar to Artemis (if you know it? It's awesome), though got an idea was that I build the ship (master client) and then everyone can make stations for it. And would be cool if people could just host their stuff in their dropbox folder or something. Unity can make lan stuff easy, so why shouldn't it be possible in html & javascript? –  The Oddler Sep 16 '12 at 13:47

1 Answer 1

up vote 0 down vote accepted

Node.js could be really helpful in your case. You could also try to use HTML5 WebSocket API.

share|improve this answer
I ran across node.js though I didn't think it could actually host a lan server from within the browser. Am I correct in thinking that? I'll try out one of their examples, though any more information about node to get me started is always appreciated :D Thanks! –  The Oddler Sep 16 '12 at 13:54
@TheOddler — Yes, you are correct. It lets you run JS code outside a browser (typically to run a server). The host would have to download Node, and your JS software and then run the latter using the former. –  Quentin Sep 16 '12 at 14:15
And is it then possible to connect from a game on a webpage to this server? If not, it won't have any advantage (for the idea I had) to any other networking solution. –  The Oddler Sep 16 '12 at 18:11
