WPI-Suite/wpi-suite — pull request #75 by tmathmeyer (2014-04-14 04:28:23+00:00)
Title: Longpolling

This pull request does a few things:

moves the java version from 1.6 to 1.7 so that code such as:
```
HashMap> = new HashMap<>();
```
is supported. I'ts just simpler and cleaner. If this is an issue for
any part of tiki, it can be reverted without issue.

secondly, this adds a dependency on the jodatime (http://www.joda.org/joda-time/) library. It is effectively a nicer version of java.util.Date until it is upgraded with java8.

most importantly, this adds long polling, or more commonly known as "push" (thanks apple...)
The problem of live updating has three solutions:
periodic updates, long polling, and sockets.
Periodic updates are the most naive, but simple solution to this problem, but introduces a significant network overhead, and less-than-live updating, making it relatively useless for things like chat or games.

Long polling is probably the hardest to implement, but has the advantage that it can be built on top of an existing framework, like http or ftp. It's only downside is that there is a full network request for every even that happens on the server side, and so becomes ineffective with significantly large numbers of users (100+ or so).

Finally there are raw sockets, which are probably less difficult than long polling, but require knowledge of networking, and the structure of packets and serialization. They are the fastest form of updating, however they also become unruly above 100 or so. (at least the java socket implementation does).

After weighing these options, our team decided that long polling was the best option for our project and really for janeway in general. This is our implementation from B term this year, which was cleaned up in the days before and following the final presentation, and has been extensively tested on our computers to have no memory leaks and perform well with many users.

why am I submitting this? I was talking to a current student about the benefits of long polling in fuller commons when Professor Pollice walked in. Ian asked him if their team could use our code in their project; the answer was no, but it was suggested to me that there should be a pull request so that all the teams can use it. If needed I can supply a demo module and/or wiki tutorial on how to use this code.

Team YOCO.