Page 1 of 1

Web Sockets

Posted: Tue Jun 07, 2011 7:39 pm
by hallsofvallhalla
So I have been fooling with web sockets and it seems you need to be able to run the server like an app. Maybe there is something I am not understanding but can the server code/app be run on a paid for host?

Also what is the shortest increment of time anyone has used ajax for queries? 1 second? 2 seconds? 5 seconds.

Re: Web Sockets

Posted: Tue Jun 07, 2011 9:15 pm
by Jackolantern
It must be a dedicated application host or higher. Web hosts are out if you need your own server application. A web server cannot handle TCP/IP requests like that, so users will be either buying their own server application, using something open source, or creating their own.

Sounds like it is time to lose that grudge against Java, right? ;)

Re: Web Sockets

Posted: Tue Jun 07, 2011 9:23 pm
by hallsofvallhalla
haha would still have to run my own server though. Am looking for a web host solution.

The bad news is I did some test with Project battle using ajax calls. I have everything local, all tables indexed and very small and the fastest i could get ajax to run the query and return the data was 4 seconds. That is way to high for a MMO. I am thinking one issue I may have is it is closing the connection every time. I need to keep it open. Does comet have a solution for this. Comet's way of waiting on a response does not help as I need to send every second or 2 regardless.

Re: Web Sockets

Posted: Tue Jun 07, 2011 9:31 pm
by hallsofvallhalla
hmm seems comet does keep an open connection. Going to give it a try.

Re: Web Sockets

Posted: Tue Jun 07, 2011 10:46 pm
by Jackolantern
Comet requires a custom server as well. HTML5 essentially kills Comet. If you want more traditional Comet-style techniques, check out HTML5's "server-sent events API". It is basically Comet without all the complicated client-side hacks to make it work. However, the server-side still needs a full server application to make it work as far as I know. I also think native server-side events are a decent bit faster than traditional Comet. However, websockets are over 3x faster than Comet or Ajax in any form.

Re: Web Sockets

Posted: Wed Jun 08, 2011 1:47 am
by hallsofvallhalla
yeah I think for my wants I will be stuck with ajax which will not be fast enough. I have seen videos on youtube of ajax running like a normal mmo but I dont believe it. I think it is a farce. You will never get asynchronous multiplayer to be spotless.

Re: Web Sockets

Posted: Wed Jun 08, 2011 1:58 am
by Jackolantern
You could always scour the web for ways to speed it up. There are customizations you can do to the server (some of which I think you can do on a good rented host) to speed up AJAX a bit, mostly dealing with the way HTTP data gets cleaned up before being sent. However, like you said AJAX is always going to be a bit too slow for true, real-time MMORPGs. Even on my development computer running WAMP, I can't get a simple, short AJAX response posted to the page in under about 750ms, and that is with a super-simple PHP script that only echos text back, and with no network latency at all.

Re: Web Sockets

Posted: Wed Jun 08, 2011 2:49 am
by hallsofvallhalla
same here, I am going to change the game to mold around the current tech instead of molding the tech around the game.

Re: Web Sockets

Posted: Wed Jun 08, 2011 3:55 am
by Xaleph
Hmm Ajax is not the fastest option out there, however, Ajax calls can be fast enough for simple operations. Mostly because speed does not depend on the server. So, for an extensive MMO which requires near real-time updates, it`s going to be tough, because most clients will not be able to handle all the information. Sounds weird huh?

Anyway, the fastest ajax calls i got so far are under 200ms. This was running on a nginx server which had PHP installed on it. Fun note: I used JSON requests. Somehow, sending JSON is faster. I don`t know why, but when i looked into it, it seems that file headers are faster then html headers.

Re: Web Sockets

Posted: Wed Jun 08, 2011 1:47 pm
by hallsofvallhalla
I still do not see 1-2 second updates possible. I have canned the idea for now until web sockets become more widely accepted and used. Right now the browsers are all not compatible out of the box.