New site launched built on Tornado and tornadio: Kwissle.com. Thanks guys!

39 views
Skip to first unread message

Peter Bengtsson

unread,
Jun 5, 2011, 1:14:25 PM6/5/11
to python-...@googlegroups.com
For a couple of months now I've been working on a web app which is a socket based game where you battle against other random people in general knowledge questions. 
Everything is built in Tornado and tornadio. For the curious, database is MongoDB, database glue is MongoKit and it's hosted on EC2. Thanks for all the hard work that made this possible! 

All the websocket stuff is taken care of by socket.io on the client side. A great piece of kit!

One thing that might interest people is that I actually started building the game (socket stuff) in NodeJS and eventually gave up. The reason for this was twofold:
1) I wanted to learn NodeJS by real-world example
2) Tornad.IO was causing all sorts of trouble

Then, when it came to writing tests NodeJS was just giving me pain and misery. I really gave it an honest go. I had all the latest tools installed but I was just not making enough progress to make it worthwhile. (Note: this is a side-project which means I work on it at night and on odd weekends)
Basic tests was easy but as often, the fixtures make the tests harder and harder and I found myself spending more time with async logic that business logic. 
Eventually, and also when I heard some good stuff of MrJones's tornadio I created a branch, built a prototype and never looked back. It was just so much easier!

The Tornado part of it takes care of EVERYTHING except the actual socket stuff. Currently port 8888 is open and it only does socket traffic. 
Another thing I think is neat is that I'm entirely leaving the authentication over to our social world: Google, Twitter and Facebook. This saves me from having to build a registration, a login, a password changing thing, a forgotten password thing, etc. Awesome!

So, have a go and come challenge me online! 

Peter   

Adil Khashtamov

unread,
Jun 5, 2011, 1:21:18 PM6/5/11
to python-...@googlegroups.com
Congratulations! Nice stuff! Decided to play, but no people online :( Hope things will change very soon :)

2011/6/5 Peter Bengtsson <pet...@gmail.com>



--
Adil Khashtamov

Rafael Garcia

unread,
Jun 5, 2011, 1:27:56 PM6/5/11
to python-...@googlegroups.com
just played a game--really fun! It'd be cool if you could challenge someone specifically or play again with someone you just played with

Frank Smit

unread,
Jun 5, 2011, 2:58:07 PM6/5/11
to python-...@googlegroups.com
Sounds nice, but there's no one online. :(

Peter Bengtsson

unread,
Jun 5, 2011, 3:58:36 PM6/5/11
to python-...@googlegroups.com
Then invite your mates!
It's actually really fun to play against someone in the same room if
you can pull that off.

--
Peter Bengtsson,
home www.peterbe.com
fun donecal.com
work www.mozilla.com

Peter Bengtsson

unread,
Jun 5, 2011, 4:05:01 PM6/5/11
to python-...@googlegroups.com
Then invite your friends :)

I am working on a cool feature to remedy that; as I know, by average,
how people are answering the questions I can theoretically make it
possible to compete against the computer which means you're competing
against everyone else. Cool, eh?!

--

Serge Koval

unread,
Jun 6, 2011, 8:38:01 AM6/6/11
to python-...@googlegroups.com
Hi Peter,

Tried it - works great and looks like I lost to you my first game.

Question - why did you serve tornadio on port 8888 if you use Tornado as
a application server? Or Tornado on port 80 is behind a proxy that is
not websocket aware?
If you will have everything running on port 80, you'll get Opera working
and people that are proactively firewalled will be able to play the game
as well (office, cough).

Thanks,
Serge.

Sid.Upadhyay

unread,
Jun 7, 2011, 1:36:24 AM6/7/11
to Tornado Web Server
Great game, indeed!

Peter, I've been playing around with tornadio as well and recently
setup HA Proxy to loadbalance multiple tornadio instances. I've
uploaded a sample configuration, if it helps.
http://tornadogists.org/1011730/

Best of luck,
Sid

Peter Bengtsson

unread,
Jun 7, 2011, 3:25:08 AM6/7/11
to python-...@googlegroups.com
That's really interesting. My site doesn't have a traffic size problem
yet but I've always thought that HAProxy is going to be the best
solution when I have the problem.

I posted a comment on there for you: "How would this work with Flash
traffic or XHR-polling?"

--

Peter Bengtsson

unread,
Jun 7, 2011, 3:25:49 AM6/7/11
to python-...@googlegroups.com
The reason for not putting the websocket traffic via Nginx on port 80
is because it doesn't work with Flash sockets I don't think.

--

Sergey Koval

unread,
Jun 7, 2011, 3:39:37 AM6/7/11
to python-...@googlegroups.com
Yep, that's what I was asking. Nginx does not work with WebSockets,
flash sockets, xhr-multipart transports.
However, HAProxy does work with all them - flash socket transport is
just an flash implementation of the WebSocket in a flash.

Serge.

Peter Bengtsson

unread,
Jun 7, 2011, 5:11:23 AM6/7/11
to python-...@googlegroups.com
Then I'll take a fresh close look at HAProxy sooner rather than later.

Sid.Upadhyay

unread,
Jun 7, 2011, 10:02:01 AM6/7/11
to Tornado Web Server
Peter, I posted a response: http://tornadogists.org/1011730/#comments-1

The only issues I'm seeing with flash sockets is the need to bind to a
different port per instance. I think the most prudent solution may be
to assign the flash policy port as N + the http/ws port and then use a
standard port in the Socket.IO javascript. Then HA Proxy need only
loadbalance incoming requests on the external port to a server in the
flash server pool. I don't know how the cookie identification system
will work with this, but I'd venture to say that you can expect
similar results as server affinity with normal websockets and HTTP
requests.

Keep me posted on what you find.

Best,
Sid

On Jun 7, 4:11 am, Peter Bengtsson <m...@peterbe.com> wrote:
> Then I'll take a fresh close look at HAProxy sooner rather than later.
>
> On 7 June 2011 08:39, Sergey Koval <serge.ko...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > Yep, that's what I was asking. Nginx does not work with WebSockets,
> > flash sockets, xhr-multipart transports.
> > However, HAProxy does work with all them - flash socket transport is
> > just an flash implementation of the WebSocket in a flash.
>
> > Serge.
>
> > On Tue, Jun 7, 2011 at 10:25 AM, Peter Bengtsson <m...@peterbe.com> wrote:
> >> The reason for not putting the websocket traffic via Nginx on port 80
> >> is because it doesn't work with Flash sockets I don't think.
>
Reply all
Reply to author
Forward
0 new messages