Is it possible to create online games in real time in JavaScript?

Is it possible to create online games in real time using JavaScript? I saw flash, but I'm interested in creating a multi-player browser game that is independent of any plugins. I read that it is not possible to disconnect Ajax connections for message streaming, and it is not possible to make several new Ajax connections per second in order to keep the client and server in sync.

+7
javascript network-programming
source share
6 answers

Use WebRTC instead of WebSockets to access peer-to-peer network and UDP. See here: Does WebRTC use TCP or UDP? and WebRTC vs Websockets: if WebRTC can do video, audio and data, why do I need websites?

+4
source share

It looks like http://socket.io/ is a good solution.

+4
source share

WebSockets is a solution for real-time (low latency) interaction with JavaScript in a browser. There are backups to provide the WebSocket Flash API.

You can use JavaScript on the server and use something like http://RingoJs.org , which has connectors for WebSockets. If you use these two, you will get the following:

// SERVER websocket.addWebSocket(context, "/websocket", function(socket) { socket.onmessage = function(m) { // message m recieved from server }; socket.send('my message to the client'); }); // CLIENT var ws = new WebSocket("ws://localhost/websocket"); ws.onMessage(function(m) { // message m recieved from server // do something with it return; }); ws.send('message to server'); 
+2
source share

It. Look at a technology called Comet (like Ajax on steroids). Lift (a Scala web framework, twitter and others use it) has excellent built-in Comet support.

0
source share

As I know, sockets without plugins are only possible in HTML5.
But you can use flash to accomplish this task. Since almost every browser supports flash memory, I think that everything is in order.
There are also some hacks that let you do the same without a bunch of ajax calls. Try to find Long Polling.
Hope this helps.

0
source share

Yes, and it does not require any special libraries, which, apparently, mean certain people.

-one
source share

All Articles