Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
== Welcome to Chat Server This application is a chat server that runs in a web server. It was developed for the CIS 725 Course (Advanced Computer Networks). The application offers all the functionality stated on the Programming Assignment description, but the operation is slightly different. These differences were discussed with Dr. Neilsen, and he agreed with them considering that the program is developed using Ruby on Rails. == Requirements To start a chat server, the following software must be installed on the server: * Ruby 1.8.7 * RubyGems 1.3.5 * Ruby on Rails 2.3.4 * SQLite 3 (Tested with SQLite 3.6.12) The instructions about how to installed all this software can be found on the official Ruby on Rails web site: http://rubyonrails.org/ == Application Design The chat server is a RESTful application that exposes the following resources: * Folks: The users that have logged to the server. Base uri: /folks * Rooms: The chat rooms (or chat sessions as they're called on the Programming Assignment Description) that have been created. Base uri: /rooms * Messages: The messages that have been posted by a folks on rooms. Base uri: /messages The following HTTP verbs are used for the operation of the server: Folks Resource: GET /folks/new Renders a form that asks the user what nick he wants to use. This is the chat server home page. Rooms Resource: GET /rooms Renders the list of rooms available and displays a form for creating new rooms GET /rooms/<id>?folk=<folk_id> Renders the chat room with id <id> for the user with id <folk_id>. This page contains a list of the messages posted, a list of the folks online and a form for adding new messages to the room. This page is periodically sending through AJAX a GET request to the messages resource. POST /rooms Creates a new room. The document that is expected to be posted is a json representation of a room resource. This is called using AJAX by the form displayed in the GET /rooms page. DELETE /rooms/<id> Removes a room from the list. This action is called using AJAX by the "Remove" link that is displayed on the GET /rooms page. Messages Resource: GET /messages?room_id=<room_id>&folk_id=<folk_id> This resource has no defined html views. It's intended to only be called by AJAX requests. It polls the message list for new messages in that room. It internally updates a timestamp of the last message received by the folk (defined by the folk_id parameter). This timestamp keeps track of what messages are fresh and need to be displayed on the message list and what messages are old and are already displayed on the page. == Application Usage: To start the web server for this application simply navigate the chat.git directory and run the following command: ruby script/server If for any reason you need to run in a different port you can start the server with the following command ruby script/server -p <PORT> Once the server is up and running. Start a web browser and point the address to http://localhost:3000/ The browser will display a welcome screen. You will be prompted to pick a nick. Write your nickname and press enter. You will be redirected to the chat server lobby. In this page you can pick a chat room or create a new one. To enter a chat room simply click on the chat room name. Once in the chat room you will be able to chat with anyone that's available. You will also be able to see the history of all the messages that have been posted on the chat room. If you want to test the chatting capability you will need to start another web browser and point it to the http://localhost:3000/ uri. It's extremely important to use a different browser for testing the chat (because the session is used to store the list of online users). For example you can run one client using Safari and another one using Firefox (this is in the case that you want to make the test in a single machine). If you perform the test using different computers it won't matter what browser you're using. == Implemented Points Of the 3 points described on the Programming Assignment description, all of them are implemented in this application: 1- Chat Room 2- Chat Room List Management 3- List of online users per Chat Room. == Special Notes: Since the application is running in a browser and not on the console, there's no script output added to this deployment. This deployment will include the development database. If you want to start a new database or want to run the application on production mode you'll need to run the migrations to generate the database. To do so run the command: rake db:migrate