Comet Server

26 views
Skip to first unread message

Trevor Orr

unread,
Jun 26, 2011, 11:13:51 AM6/26/11
to mootools
I was thinking about implementing a comet server into a MooTools game I wrote so players can play against each other instead of against computer players and was wondering if anyone has implemented one and if so which one and would you recommend it use?  I know there quite a few of them out there, I guess I should point tout that this is a personal project and not something I can spend any money on.

I know this is not really directly a MooTools questions but since my game is written in MooTools and there seems to be a lot of good help here I thought this would be the best place to ask.


verylastminute

unread,
Jun 26, 2011, 3:32:43 PM6/26/11
to mootool...@googlegroups.com
I would recommend, instead of comet, that you consider using nodejs + socket.io.

Fli7e

unread,
Jun 26, 2011, 4:07:28 PM6/26/11
to MooTools Users
node is nice but cannot be used on e.g. a shared hosting environment
where i am not allowed to bind ports or run permanently forked
processes.

about comet: persistent open connections will burn your webhoster all
the way if you persistently keep two webserver process up all the time
(one for you, one for your opponent).

Imagine your game is going to be played but - hmmm, 1000 People ...
This will result in 1000 persistent open Webserver Processes, 1000
persistent interpreter (PHP/Ruby whatosever) Processes, maybe (i bet)
1000 open Database Connections ... all eating memory (at least the
base memory).

Either Comet nor node are shared hosting compatible and Comet in
particular - even if it is a nice feature - will buttkick your
webserver environemnt.

I remember a discussion on this Group about Comet/Node and all the pro/
cons ... Maybe a search can help you to discover and explore the long
discussion about it :-)

On 26 Jun., 21:32, verylastminute <cgp...@gmail.com> wrote:
> I would recommend, instead of comet, that you consider using nodejs<http://nodejs.org/>+
> socket.io.

Trevor Orr

unread,
Jun 26, 2011, 4:10:47 PM6/26/11
to mootool...@googlegroups.com
So then if I am wanting to do peer/peer communications then I would need to rewrite my whole game in Java or Flash or something like that?

Arian Stolwijk

unread,
Jun 26, 2011, 4:12:23 PM6/26/11
to mootool...@googlegroups.com
I believe Node.js / socket.io was smarter than that...

Sanford Whiteman

unread,
Jun 26, 2011, 4:16:32 PM6/26/11
to verylastminute
> I would recommend, instead of comet, that you consider using nodejs<http://nodejs.org/>+
> socket.io.

... not really "instead of" unless you define Comet as no-plugin,
HTTP-only (which wouldn't be workable given the number of Flash/Java
streaming applets rebranded under Comet). I think calling socket.io a
state-of-the-art Comet server (+ more) isn't an insult.

-- S.

Trevor Orr

unread,
Jun 26, 2011, 4:22:33 PM6/26/11
to mootool...@googlegroups.com
I had briefly tried out APE because the client side was written in MooTools but is on MooTols 1.2 I think and I just finished upgrading my game to 1.3 and when I tried APE I got all kinds of errors.  Apparently they are in the processing of rewriting the client side to use generic JavaScript instead of MooTools but who knows when that will be ready.

Sanford Whiteman

unread,
Jun 26, 2011, 5:39:16 PM6/26/11
to Trevor Orr
> So then if I am wanting to do peer/peer communications then I would
> need to rewrite my whole game in Java or Flash or something like
> that?

Peer-to-peer is beyond the scope of Comet -- seems like you're
changing the reqs a bit. :)

How many channels (games) and subscribers per channel are you
expecting? Is this <n> simultaneous one-on-one games?

Depending on the load, we might have some space on our hosted WebSync
to barter with you in exchange for getting more data on WebSync perf
(we are in an exploratory phase of switching from in-house XHR
long-polling to hosted WS). Contact me off-list for details.

-- S.

Trevor Orr

unread,
Jun 26, 2011, 5:53:23 PM6/26/11
to mootool...@googlegroups.com
Right now the traffic on the site is really small, probably mostly because you can only play against a computer  and the fact that I have not advertised it all, I think it is only getting a few hundred games played a week I think.

In the game setup you can choose from 2-8 players, right now all of the opponents just computer players.  I have this on facebook in an iframe but it does have its own website but about 90% of the traffic comes from facebook.  So I was thinking more of something like a person creates a game, invites some friends to play with a facebook invite, then when the person who created the game wants to starts they can start the game at any time and however many opponents have not been filled up by humans would then becomes computer players.

I guess I used the wrong wording in the last message, I guess if there is up to 8 players it would have to be more of a Comet system than a peer-to-peer.

Sanford Whiteman

unread,
Jun 26, 2011, 6:14:48 PM6/26/11
to Trevor Orr
> I guess I used the wrong wording in the last message, I guess if
> there is up to 8 players it would have to be more of a Comet system
> than a peer-to-peer.

Peer-to-peer would be great -- but nothing standard like that can be
done inside the browser now. You have to use some kind of shared host
that publishes data to the subscribed Comet clients.

-- S.

Mike

unread,
Aug 26, 2011, 11:19:06 AM8/26/11
to mootool...@googlegroups.com
I wasn't able to get ape-server working for the same reason: MooTools 1.3.

The more I read on this topic the more I realize the trend is toward WebSockets anyway, which isn't all there but is a real solution.  Comet is more of a workaround.  Given our focus it probably makes more sense to build to WebSockets and only support a limited set of browsers.

In any case, it looks like socket.io is next on my list.

Mike

Aaron Newton

unread,
Aug 26, 2011, 11:57:00 AM8/26/11
to mootool...@googlegroups.com
FWIW, Tornado is also a pretty robust solution.

Martin Hewitt

unread,
Aug 26, 2011, 12:22:09 PM8/26/11
to mootool...@googlegroups.com
Comets natively uses WebSocket as a transport type if it's supported, otherwise it falls back to long-polling and callback-polling. Also, it contains a security structure for clients, which is useful for authenticating and authorising.

Just my $0.02 having used it for a couple of years!

Martin

Sent from my iPhone

Reply all
Reply to author
Forward
0 new messages