Simple chat on WebSockets, using NodeJS with Express.
This project was created by Maxim Mazurok during a teaching session to showcase use of WebSockets to students.
Demo is deployed to heroku and can be acceced by this URl: https://nodejs-ws-chat.herokuapp.com/
(It may take a couple of minutes to start sleeping server)
You can open this URL on multiple devices, or in different browser tabs (simulating multiple chat users).
Type your message and hit enter
or press send
button. Message will be recieved by all other currently opened instances of the app.
- Clone repo:
git clone https://github.com/Maxim-Mazurok/nodejs-ws-chat
- Install dependecies:
npm install
- Install and run ngrok:
Note:
ngrok
is not required, I'm using it to make WebSockets work on local environment and to share url to other devices
npm install --global ngrok
- Run the server:
npm start
- Open chat:
After starting server, run
ngrok http 8080
and open providedhttps://xxxxxx.ngrok.io
page on multiple devices, or in different browser tabs (simulating multiple chat users). Type your message and hitenter
or presssend
button. Message will be recieved by all other currently opened instances of the app.