COMP 4620 Web-Based Information Systems
Seminar/Lab 7
MongoDB, WebSocket, and Chatting App
- Objectives
- How to connect to MongoDB using JavaScript
- How to implement WebSocket client and server programs
- How to implement Chatting Application
- Exercise– WebSocket client, and TRU chatting app
- Complete test_chatting_client_student.html.
- Initially WebSocket connection is made to the cs.tru.ca:your_port echo server.
- This program includes ‘SignIn’ and ‘Join’.
- When the ‘Submit’ button is clicked, ‘username’ and ‘password’ are read from the two input elements,
- An object is created with the username and password above.
- Two application-level commands, ‘signin’ and ‘join’, are used.
- This object is converted to a string and sent to the echo server.
- When a message comes from the echo server,
- The message is a string of an object.
- The message is displayed,
- Converted to an object, and
- All the key-value pairs are displayed.
- For echo server, you can use the standalone code in the course web.
- TRU chatting app
- In this week, you need to implement ‘join’, ‘unsubscribe’, ‘signin’, and ‘signout’.
- Write your own TRU chatting server, with your port number.
- You can use standalone server. An example is in the course web.
- For the ‘join’ command,
- If the username does not exist in MongoDB, then save it. You should use hashing for the password.
- Success or failure message is sent back to the client for test.
- For the ‘unsubscribe’ command,
- If the username and password exist in MongoDB, then delete it.
- Success or failure message is sent back to the client for test.
- For the ‘signin’ command,
- For the ‘signout’ command,
- Improve the client program in 2) to test your chatting server. Do not forget that the server needs to be running all the time. You need to use a different port number, not the port number used in 2).
- Assignment
- The URL of the test program in 2).
- Total marks: 5
- Due: 6:00 PM, November 3, 2015.
- Any late submission will not be accepted.
- The URL of the test program in 3).
- Total marks: 20
- Due: 2:00 PM, November 5, 2015. (NOT 6:00 PM)
- Any late submission will not be accepted.
- The assignment submitted by 6:00 PM, November 3, 2015 will get 10% bonus.
- You should not update the application after you submitted. The information of any update of a file/directory will be left on CS, and I can check the last update date and time.
- The evaluation will be usually one of pass, half-pass, and fail. Most incomplete applications will get fail.