Over the past weeks, I have been dabbling in Comet style, push-based, asynchronous communication enabling frameworks and libraries – including CometD, Atmosphere, Kaazing, jWebSocket, Grizzly and others. This short article will describe how I went about setting up Atmosphere on my local environment to the point that I could successfully run at least one of the samples shipped with Atmosphere – and had the sample loaded in NetBeans for inspection and further development.
The article presumes some knowledge of Git and requires Git to have been installed. See my earlier article (https://technology.amis.nl/blog/14676/preparing-your-environment-for-modern-open-source-java-libraries-and-frameworks-using-git-and-maven-throwing-in-tomcat-as-a-bonus) for details on what I did to get Git going as well as have Maven configured. I also described how to set up NetBeans (https://technology.amis.nl/blog/14661/first-experiences-and-getting-started-with-glassfish-3-1-and-netbeans-7-x-its-a-breeze) and Tomcat 7 (https://technology.amis.nl/blog/14688/installing-tomcat-7-and-configuring-as-server-in-netbeans).
Atmosphere currently has its home on GitHub: https://github.com/Atmosphere/atmosphere. This where the sources are, both for the framework itself as well as for the samples demonstrating some its capabilities.
To get going locally, I cloned this repository from GitHub to my local Git environment. Here are the steps:
Run Git GUI:
Click on Clone Existing Repository
Set the source location – the GitHub URL for Atmosphere. Specify the local directory (not yet existing) into which the repository should be cloned.
Click on the Clone button.
At this point, source are going to be downloaded from GitHub and copied to the local file system. This will take some time.
When cloning is done, the file system will look like this:
The Git Repository contains the sources for Atmosphere and its samples. It also has pom.xml files that allow build of [components of] the framework.
Let turn our attention to the TicTacToe sample.
Open the command line and set focus to the TicTacToe directory. Run Maven with the clean install target:
Maven will go and build the tictactoe sample. In order to do so, it will download many dependent objects to the local Maven repository:
After some dozens of seconds, Maven will complete:
The WAR file has been built:
and is ready for deployment on Tomcat.
Open the Tomcat Administration console in a browser window and click the browse button to select a WAR file to deploy:
Select the WAR file that was just built by Maven:
and click the Deploy button.
After a little while, the application is deployed and shows up in the list of applications.
Click on the link for atmosphere-tictactoe application to bring it up:
and open a second window with the same URL – as the game of TicTacToe should be played from two clients in order to see the push effect: