The idea was to build chat with basic functionality:
- User is able to select
username
and print messages viaEnter
keydown orSend
button; - User's personal messages are styled with blue color. User's
id
is tied to tab so if you open several tabs with chat all the users will be different; - User is able to act
/me
action. To do this the user need to print message which starts with/me
text and the message will be shown in small text. If user, let's name it Godzilla, print/me hello New York
we will seeGodzilla hello New York
; - If user get message being unfocused to the chat, there will play sound of the new message. At the same time
icon
andtitle
of the chat tab will be replaced to the "unread" view. - There is simple rooms functionality. Chat has one general room the messages of which will be shown at all rooms. But also we have 3 private rooms that can used for private chatting. If someone enters or leaves room you get message about it.
- There is an ability to show
10
last messages when your enter's chat. (It will more efficient to make it with database, but here these last messages are stored in memory)
There vere used several basic libraries such as socket.io
and express
for backend. Frontend part was build without any frameworks or libraries except socket.io-client
for server interactions. The project was configured via webpack
and ready to production deploy. It was done with help of heroku
and the result you can find here https://zenby-simple-chat.herokuapp.com/ (don't worry if it doesn't loads at one second, be patient until heroku
start server)