程序代写代做代考 js Hive ECLT 5830

ECLT 5830

ECLT 5830
Assignment #5 Specification
(Due: 21 Apr 2019)

Specification
Objective: In this assignment, you will need to
Modify ‘websocket’ example so that it would display number of users in the chat room.
Make use of ‘sanitize-html’ NPM module to filter unwanted HTML tags in the messages.

You can find the requirements for each page in the following slides.

Task #1: Show number of users in the chat room
Modify ‘public/chat.html’ so that it would show also the number of users currently connected to the chat room.

Hint:
The server may have to broadcast two kind of messages
1) A message submitted by a chat room user
2) Number of users who are currently connected to the server (this message should be broadcasted to all connected users whenever a user is connected/disconnected to/from the chat room.)

Since there are two types of messages the client (the JS code in file ‘public/chat.html’) needs to handle, you need to decide how to format the messages so that the client can decide what action to take.

Task #2: Filter the messages sent by the user
Currently the server-side code in ‘websocket’ example broadcasts all incoming as is. As a result, it is vulnerable to XSS attack.

In this task, you need to make use of ‘sanitize-html’ NPM module to filter all messages so that
Only tags allowed are: b, i, a, img
For img tag, the only attribute allowed is ‘src’
For a tag, the only attribute allowed is ‘href’
No attributes are allowed in b and i tags

You can find the instructions and sample code to use sanitize-html NPM module at https://www.npmjs.com/package/sanitize-html.

Assessment Weight
Task 1 (50% of assignment #5)
Task 2 (50% of assignment #5)

Submission
To submit your solution, please archive the “npm project folder” of your app into a ZIP file, and upload the ZIP file to Blackboard.
Please remove the subfolder “node_modules” from your project folder before you ZIP the folder.

/docProps/thumbnail.jpeg