Skip to content

Just an experimentation project. Getting hang of the basics of WebSocket.

License

Notifications You must be signed in to change notification settings

Abrifq/chat-websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Websocket Chat Test

Just a small test thing to experiment with websocket.

How to test for yourself

Alrighty then! Follow these steps:

  1. Run npm install to install dependencies.
  2. Run the project with npm start.
  3. Open localhost:8080 in your browser
  4. Enter a name and then send some messages!
  5. Open the page in another tab to watch the message come to there as well!

For ones who want to tinker

  • You can use npx nodemon instead of npm start, however this means changing websocket code will restart the server and drop the connections. That will be difficult to catch on so I don't recommend nodemoning this.
  • You can use the enviroment variable PORT to change the default port 8080.
  • On client side, try reading Websocket class documentation on MDN. On server side, try reading ws.js' documentation. Typescript types also helps but those are the last resorts.

About

Just an experimentation project. Getting hang of the basics of WebSocket.

Topics

Resources

License

Stars

Watchers

Forks