DEV Community

Cover image for Real time websockets connection 🔥 with Nodejs (Chat App example).

Real time websockets connection 🔥 with Nodejs (Chat App example).

Mustafa Anas on January 09, 2020

When I first started learning Full Stack JS development, I could barely understand the difference/relationship between a server and a client. I rem...
Collapse
 
davidvine profile image
David Vine

Great article!

Small typo though (sorry) ...

In all the example code you've used port 5000 but then, near the end of the article, it says:

"After your React app runs, you should see it at localhost:3000."

Collapse
 
mustafaanaskh99 profile image
Mustafa Anas

Maybe I should have made this more clear.
Here is the thing,
Since the client and the server are two different things, they also run on two different ports.
When you do create-react-app, by default your app (client) will run on port 3000 where as for the server, we choose to run it on port 5000

Collapse
 
davidvine profile image
David Vine

Thanks Mustafa. Apologies, I jumped the gun and hadn't tested it for myself first. 🤦‍♂️

I've run through the process now and did find that the following command doesn't work:

npm create-react-app my_app

The "npm" should be "npx". i.e:

npx create-react-app my_app

For npm use the following command:

npm init react-app my_app

Source: github.com/facebook/create-react-app

Once again, great article!

Thread Thread
 
mustafaanaskh99 profile image
Mustafa Anas

you are so right. I meant type npx. Thanks again!

Collapse
 
hinasoftwareengineer profile image
Hina-softwareEngineer

Can you write a blog on how to get started with react?? Because i have learnt nodejs and now want to learn react.

Collapse
 
mustafaanaskh99 profile image
Mustafa Anas
Collapse
 
mustafaanaskh99 profile image
Mustafa Anas

I will try and craft something. Meanwhile, I find Wes Bos to be a great teacher. Look for his course online: React for beginners

Collapse
 
hinasoftwareengineer profile image
Hina-softwareEngineer

Thanks

Collapse
 
hinasoftwareengineer profile image
Hina-softwareEngineer

Amazing article 🔥🔥

Collapse
 
mustafaanaskh99 profile image
Mustafa Anas

To the best of my abilities, I break concepts down and make them sound as silly as possible.

Collapse
 
sergeykapshuchenko profile image
Sergey Kapshuchenko

It doesn't work good for me, for 1-3 messages it works good, but when I have more then 3 it takes too long to send message, so I gotta refresh page.