views:

95

answers:

4

Is it possible to create a socket based multi-player game client using html5? Does html5 allow socket programming?

A: 

You can use the WebSockets draft standard in supported browsers. According to this question, Chrome, Firefox 4, and Safari support it.

Matthew Flaschen
+3  A: 

HTML5 allows a limited bi-directional communication with server via the WebSocket object. It may allow you to write games what use simple networking but it does not allow raw access to underlying network. So the answer to your questions is:

  1. Yes, but this depends on the complexity of the game and you will have to proxy all messages via the server.

  2. No it does not allow socket programming as, say, as a programing platform such as Java does.

naikus
+1  A: 

Depends on how "big" your multiplayer is going to be, I've played around with WebSockets recently you can take a look at the results here: http://github.com/BonsaiDen/NodeGame-Shooter

It's definitely pretty easy to get started with this, but the challenge is to keep the actual bandwidth usage low, just using plain JSON will let the bandwidth skyrocket.

Ivo Wetzel
A: 

HTML5 has nothing to do with sockets unless you mean WebSockets.

Rob
thanks, can you tell me what's the difference between a socket, and a websocket?
aryaxt
There are links in the other posts as well as one in the "Linked" portion of the right-hand column.
Rob