Web Sockets

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Web Sockets

Post 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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Web Sockets

Post 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? ;)
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Web Sockets

Post 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.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Web Sockets

Post by hallsofvallhalla »

hmm seems comet does keep an open connection. Going to give it a try.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Web Sockets

Post 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.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Web Sockets

Post 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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Web Sockets

Post 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.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Web Sockets

Post 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.
Xaleph
Posts: 897
Joined: Mon Feb 07, 2011 2:55 am

Re: Web Sockets

Post 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.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Web Sockets

Post 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.
Post Reply

Return to “Advanced Help and Support”