Build a Real Time Chat App With Node.js And Socket.io

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 28. 07. 2024
  • In this video you will be creating a real time chat application complete with usernames and connect/disconnect messages. You will use Socket.io to manage real time web socket connections to a Node.js server that will allow you to communicate real time chat messages to all clients connected to a single server.
    This entire project will take less than 100 lines of JavaScript and almost no HTML/CSS, but it is incredibly powerful what can be done with such little code. By the end of this video you will have a strong understanding of how to send and receive messages using web sockets and Socket.io to make any real time application.
    📚 Materials/References:
    GitHub Code: github.com/WebDevSimplified/R...
    Socket.io: socket.io
    🧠 Concepts Covered:
    - Using Socket.io to create web sockets
    - How to send messages to clients in real time
    - Handling user connection/disconnection
    - Appending elements with JavaScript
    - Sending messages to the server in real time
    🌎 Find Me Here:
    Twitter: / devsimplified
    GitHub: github.com/WebDevSimplified
    CodePen: codepen.io/WebDevSimplified
    #ChatApp #RealTimeChat #JavaScript

Komentáƙe • 771

  • @yamogebrewold8620
    @yamogebrewold8620 Pƙed 3 lety +19

    Real-time sockets are so awesome. I love how it's all built around the publish and subscribe pattern too. So easy to follow along. Awesome tutorial, thanks!

  • @AustinBeaufort
    @AustinBeaufort Pƙed 4 lety +19

    This is exactly what I needed man, thanks!
    I've been trying to use arduino with johnny-five and web sockets for a while to
    be able to change the color of an rgb led from my phone, and this has helped
    a ton in seeing how web sockets work.
    Awesome content!

  • @smallzebra19
    @smallzebra19 Pƙed 3 lety +22

    He doesn't time pass, but goes straight to the point.

  • @raeedchat4113
    @raeedchat4113 Pƙed 2 lety +2

    We used this tutorial and now we've come such a long way! Thank you web dev simplified!

  • @theartlegend3772
    @theartlegend3772 Pƙed 4 lety +379

    I'm gonna go make Twitter now

  • @patrickc.6183
    @patrickc.6183 Pƙed 4 lety +4

    That intro was great! I love your sense of humor in these videos :).

  • @kevinsetazate4502
    @kevinsetazate4502 Pƙed 4 lety +12

    Thank you bro!!! this is what i'm looking for, no templating engines or frontend frameworks just native.

  • @arifkasim3241
    @arifkasim3241 Pƙed 2 lety +6

    Succinct, lucid and a calm, soothing explanation. You are an ideal tutor. Enjoyed the video very much.

  • @elenakout
    @elenakout Pƙed 5 lety +23

    excellent as always!!
    You are the best company on afternoons that I want a break and to just have fun with a project and learning new things!!

    • @WebDevSimplified
      @WebDevSimplified  Pƙed 5 lety +7

      Thank you! I'm really glad I can make your afternoons and learning something to look forward to.

  • @ansuman4233
    @ansuman4233 Pƙed 4 lety

    This was very helpful to start with the basics!
    I have subscribed to this channel and would go through the rest of the content.
    Thank you :)

  • @A68AGaming
    @A68AGaming Pƙed 4 lety +1

    thanks so much for the tutorial, i always had a lot of trouble doing the networking stuff and this helped me a lot!

  • @God5147
    @God5147 Pƙed 4 lety

    I'm just learning node and express...etc because of my future, then I got a good page finally so I'm really thankful for this opportunity

  • @MegaNightdude
    @MegaNightdude Pƙed 4 lety +3

    That is so awesome! God bless you, man!

  • @MaNiMaBaLLa
    @MaNiMaBaLLa Pƙed 5 lety +233

    This is perfect for what I needed for my website.
    I'm definitely gonna put this to use.
    You da man.

    • @WebDevSimplified
      @WebDevSimplified  Pƙed 5 lety +26

      I'm glad I could help.

    • @samishafi6535
      @samishafi6535 Pƙed 4 lety +2

      @Shlok Jain haha you dont need to download just use npm i socket.io on terminal

    • @_.sunnyraj._
      @_.sunnyraj._ Pƙed 3 lety

      @Shlok Jain Gawar

    • @mathewsjoy8464
      @mathewsjoy8464 Pƙed 3 lety

      @@WebDevSimplified how did you get the local host at the start?

    • @plamam7
      @plamam7 Pƙed 2 lety

      @@mathewsjoy8464 vs code live server

  • @jeyzzz696
    @jeyzzz696 Pƙed 5 lety +4

    thank you for having tutorials that does not go beyond 20mins. more power to you man

  • @denisedrey921
    @denisedrey921 Pƙed 4 lety +1

    Thank you dude, that was amazing!

  • @talibelm5792
    @talibelm5792 Pƙed rokem +1

    I have made my first Javascript& Node.js project 😊 Thank you very much!

  • @mathewsjoby6455
    @mathewsjoby6455 Pƙed 2 lety

    Wow! That was awesome and I loved it! Hoping for more amazing content!!! đŸ€“đŸ€“

  • @scottmcmahon7209
    @scottmcmahon7209 Pƙed 3 lety +1

    I've said it before and I'll say it again, you're a very smart young man :)

  • @aaronj6571
    @aaronj6571 Pƙed 3 lety

    cant believe i faced click bait on other videos like THIS..... THANKS A LOT..subed

  • @erensarikaya8767
    @erensarikaya8767 Pƙed 5 lety

    perfect.
    no much talk, no blabla, only what you need to know

  • @moneyisenergy
    @moneyisenergy Pƙed 4 lety +1

    Thank you that was a great tutorial!

  • @luis96xd
    @luis96xd Pƙed rokem

    Amazing tutorial, everything was well explained, thanks!

  • @PandaciteYT
    @PandaciteYT Pƙed rokem +1

    This is exactly what i was looking for!

  • @ib6548
    @ib6548 Pƙed 4 lety

    This perfect for what I needed right now. Thank you

  • @abdulazizalghafli5240
    @abdulazizalghafli5240 Pƙed 5 lety +1

    Great topic. It's easy to understand from you. Thank you.

  • @Tsukasa1929
    @Tsukasa1929 Pƙed 5 lety +39

    Hey nice channel, I like the way you explain programming and how clear you manage the information, will you extend this topic using a different app, not a chat, mb a real time post update or a new DM receive??

    • @WebDevSimplified
      @WebDevSimplified  Pƙed 5 lety +15

      Thank you! I do want to expand upon the idea of web sockets and real-time communication since I think it is fun to work with an really useful. I right now do not have any project ideas for such a project, but I am sure I will come up with one eventually.

    • @afonsonzango
      @afonsonzango Pƙed rokem

      @@WebDevSimplified You used the port 3000, what If I wanna deploy this aplication? It won't be in localhost, so, what do I do?

  • @saitejagatadi9711
    @saitejagatadi9711 Pƙed 4 lety

    You have explained in a superb way bro..
    Keep doing these amazing videos...

  • @asdasddas100
    @asdasddas100 Pƙed 4 lety

    This gave me a great idea. Thank you

  • @richardlatham7927
    @richardlatham7927 Pƙed 4 lety

    Thanks for this. I was looking for an example to work through to help me learn about connect.io. This has worked well,

  • @lolglolblol
    @lolglolblol Pƙed 4 lety

    This is great for my school project. I think I now have a better idea of how to do it
    thanks!

  • @chungtunguyen6135
    @chungtunguyen6135 Pƙed 4 lety +1

    thanks for this tutorial my brother! keep going! i'll give you sub and like your video!

  • @mhdyousuf3392
    @mhdyousuf3392 Pƙed 5 lety

    I always wondered how chatting works... Awesome content and thanks a lot!

  • @balance_andbliss
    @balance_andbliss Pƙed 4 lety +1

    Thank you so much for this. Please make a tutorial video showing how we can create PWA chat app ? Great work dude! I speak for all newbies out there when i say... THANK YOU!

  • @nithinkjoy2158
    @nithinkjoy2158 Pƙed 4 lety

    i am very new to javascript... i didnt understand anything.. but i believe that after 6 months i will be clearly able to understand it... thank you

  • @anandpari24
    @anandpari24 Pƙed 5 lety

    Nice man, Love it

  • @myworldbox
    @myworldbox Pƙed 4 lety +12

    Priceless content
    Applause from Hong Kong student
    XDDDD

  • @BluePhoenixGames1
    @BluePhoenixGames1 Pƙed 5 lety

    Thank you, awesome as always :)

  • @tanayraj2991
    @tanayraj2991 Pƙed 4 lety

    Best video to understand the basic of socket.io library 💖

  • @electrotsmishar
    @electrotsmishar Pƙed 4 lety

    Perfect tutorial. Thanks again

  • @JCDZK
    @JCDZK Pƙed 2 lety

    Short videos ftw. Cheers buddy, subscribed

  • @robertomoura552
    @robertomoura552 Pƙed 4 lety +3

    Awesome video! Thanks! Can you also make a tutorial on how to deploy it? (On AWS for example)

  • @Legitivity
    @Legitivity Pƙed 3 lety

    Great video! very helpful! thank you!

  • @avineakduwal1518
    @avineakduwal1518 Pƙed 3 lety

    Thanks a lot.... Really searching for short sweet to the point vdo...

  • @andylib
    @andylib Pƙed 4 lety +10

    This is amazing, what I'd be interested to see is a live ticker application e.g. for a football game

    • @matstacy6830
      @matstacy6830 Pƙed 4 lety +1

      what is a live ticker?

    • @NoName-ui5ou
      @NoName-ui5ou Pƙed 4 lety +2

      Mat Stacy basically a description of a live football (or any other sports) game. So fe when someone scores you‘ll get a message like „X scored. Current score: 2:1“ or smth like that

  • @maverick4636
    @maverick4636 Pƙed 2 lety +2

    FINALLY! A good tutorial that ACTUALLY is what i was looking for! thankyou soo much!

  • @danielmadison4451
    @danielmadison4451 Pƙed rokem

    Hey Kyle what a great video. I have a running Apache server and a Mysql server running from scratch. Now I want to hook up my Database to this chat server. Then I will have 3 ports all doing something important. LOL I love a challenge.

  • @lazyworkroom
    @lazyworkroom Pƙed 4 lety

    Thanks as always! :)

  • @dpaul3447
    @dpaul3447 Pƙed 3 lety +1

    Your Intro's are pretty cool...👍👍

  • @sherifsalah5563
    @sherifsalah5563 Pƙed 5 lety

    Wow, you are absolutely amazing.

  • @scottj6296
    @scottj6296 Pƙed 3 lety +1

    Hey Kyle, at 6:30 I only get the console logs if I use socket versions 2.2 like you did. Using the latest socket io package with the exact same code it doesn't console.log "new user" and "hello world". Any ideas? Do we need to use express now? The tutorial using express by traversy media is working for me so far.

  • @saswatisinha7735
    @saswatisinha7735 Pƙed 4 lety

    thanks....it worked..i have learned so may things from this

  • @jeffrinmanovaprabahar
    @jeffrinmanovaprabahar Pƙed 5 lety

    Good content and good content delivery as usual.

  • @afnanamer9213
    @afnanamer9213 Pƙed 3 lety

    Brilliant!!
    You saved my life
    I was looking for a tutorial that shows how to upload files or pictures in a real time chat app? Do you have any basics ideas of how we can do it or any resources?
    Thanks a lot.

  • @sadico8344
    @sadico8344 Pƙed 4 lety +1

    A bit complicated but useful and interesting :)

  • @klznpch7512
    @klznpch7512 Pƙed 3 lety

    thanks for teaching me how to use disconnect :)

  • @MG-bm5oj
    @MG-bm5oj Pƙed 4 lety +1

    Amazing and how simple it was. How are you thinking in making it more complex? Images?

  • @babebri10
    @babebri10 Pƙed 3 lety

    Thanks for the video! How did you open the browsers for the client and server?

  • @realdlmgang3486
    @realdlmgang3486 Pƙed 3 lety

    Guys this man is a legend thank u

  • @hoangphamhuy9096
    @hoangphamhuy9096 Pƙed 4 lety

    Hi, i just found this awesome channel. Hope to get more awesome videos from you. May i ask can i use this kind of chat in shopping website?

  • @safari2411
    @safari2411 Pƙed 4 lety

    Thanks for the excellent explanation!

  • @lingxingkong5351
    @lingxingkong5351 Pƙed 4 lety +1

    Thank you for your video, it helps me a lot. But I am so curious that how can I add the real-time voice chat function 
thank you very much

  • @soultouchingsongs
    @soultouchingsongs Pƙed 4 lety

    Thanks a ton👍. You are just awesome..

  • @zehrayilmaz9660
    @zehrayilmaz9660 Pƙed 3 lety +3

    I can not see "Hello world!" on the console :( I also don' t get an error I get this in issues.: "Indicate whether to send a cookie in a cross-site request by specifying its SameSite attribute"

  • @ParrotPentester
    @ParrotPentester Pƙed 3 lety

    Best Intro EVER!

  • @Lolo5
    @Lolo5 Pƙed 4 lety

    thanks. good video as always

  • @reyarnaud5196
    @reyarnaud5196 Pƙed 4 lety +1

    Hello any idea why i cant find any tutorial in react/node/express/Socket io tutorial abotu creating 1 to 1 chat , like facebook chat or any other social media chat ? is that so different or hard to do ?

  • @nnnpooh
    @nnnpooh Pƙed 3 lety

    This video is perfect, which is perfect.

  • @thinkhub1003
    @thinkhub1003 Pƙed 4 lety

    Great thing is, you've done it in under 20mins.

  • @Tri-lime_Spanish
    @Tri-lime_Spanish Pƙed 2 lety

    YOUÂŽRE SO GOOD MAN

  • @HackerFlavio
    @HackerFlavio Pƙed 2 lety

    amazing video did had to do a bit of work arounds but over all works perfectly

    • @HackerFlavio
      @HackerFlavio Pƙed 2 lety

      @Google Security you have to be more specific

  • @etruscanetwork
    @etruscanetwork Pƙed 5 lety +1

    That's awesome!!!

  • @4541047
    @4541047 Pƙed 5 lety

    Great contents. Please continue to be unique with your contents.
    All the others web channels are just copying from Traversy Media and he's friends. But I really glad to see your different and great stuff!!
    Thanks!

    • @WebDevSimplified
      @WebDevSimplified  Pƙed 5 lety +2

      Thank you so much. I view Brad as a huge influence but I created my channel specifically to make content that is simple and concise which was what I found lacking when I was learning web development. I am glad that this teaching style resonates with you.

  • @sudonick2161
    @sudonick2161 Pƙed 3 lety

    This guy makes node js look so easy..

  • @migueldomingos4570
    @migueldomingos4570 Pƙed 3 lety

    Loved the intro

  • @mohammeddhillshaardthd2122

    Awesome sir... Just let me give a try to node...✌👍

  • @Bengadeer
    @Bengadeer Pƙed 4 lety

    I was wondering if you could advance the idea of using sockets to using Node-Red and MQTT to publish and subscribe messages between nodes in a series of videos?

  • @bikramchettri9405
    @bikramchettri9405 Pƙed 5 lety

    Thanks for the wonderful content.

  • @suelingsusu1339
    @suelingsusu1339 Pƙed rokem

    Well done... this is nifty!!!👏👏👏🙏🙏🙏🙏👌👌👌👌👌🖖🖖🖖🖖🖖

  • @MW-vg9dn
    @MW-vg9dn Pƙed 5 lety

    Excellent tutorial!

  • @emr3364
    @emr3364 Pƙed 4 lety +80

    Normal people: social distancing
    Developers: socket io chat

  • @karlj.5730
    @karlj.5730 Pƙed 4 lety

    Please create a tutorial a chat system with a database using MySQL and node.js. With just particular user you wanted to chat.
    AWESOME TUTORIAL BY THE WAY!!!!!!!!!!!!!!

  • @hsngsoftware4380
    @hsngsoftware4380 Pƙed 4 lety

    Greatly explained

  • @carloacebedo6943
    @carloacebedo6943 Pƙed 4 lety

    Nice tutorial. How can we persist the the messages in a database though? What kind of database to use?

  • @romimaximus
    @romimaximus Pƙed 4 lety

    That was awesome...thankx for sharing

  • @mraravind1111
    @mraravind1111 Pƙed 3 lety

    What keyboard do you use? It has satisfying typing sound for coding.

  • @guygontar6106
    @guygontar6106 Pƙed 4 lety +6

    That's really nice and well explained! You got it straight to the point.
    My only question is - do you run this over Express server? you browse localhost:5000 yet the IO variable gets the 3000 port as a parameter. This is something you didn't explain.

    • @selimyurekli6481
      @selimyurekli6481 Pƙed 3 lety

      5500 port is for live server. He ran client in live server.

    • @poornipriya6198
      @poornipriya6198 Pƙed 2 lety

      I am newbie to node..can anyone just explain how tat Live 5500 port created and code for tat not shown here rite..by the way rest of the code r just awesome 👏

  • @kfiryahav2987
    @kfiryahav2987 Pƙed 3 lety

    YOU ARE THE BEST!!!

  • @telugucult1629
    @telugucult1629 Pƙed 3 lety

    Thank you I am Searching for this

  • @rvbrindle
    @rvbrindle Pƙed 4 lety +2

    Great video! after scrolling the comments to see you are using live-server i now seem to be getting lots of CORS errors in the terminal when trying to run in browser

  • @ehteshamsiddiqui6841
    @ehteshamsiddiqui6841 Pƙed 2 lety +1

    I have implemented my messaing service using you tutorial thanks alot!! I have a blocker though, I'm trying to create a channel where in a master user can send the message to multiple selected users. I'm not sure how I can create a dynamic channel and listen to it only for the user whom the master user sends the message

  • @Krokodil986
    @Krokodil986 Pƙed 4 lety +1

    Haven't tried it yet but seams like it'll work. 😆đŸ€ȘđŸ€Ș

  • @anshikgupta2993
    @anshikgupta2993 Pƙed 4 lety +1

    Thank you sir helped a lot, now how can we make two client to have conversation separately

  • @crash2332
    @crash2332 Pƙed 4 lety +2

    always stuck on [nodemon] starting `node server.js`

  • @pancakes1790
    @pancakes1790 Pƙed 3 lety

    could this be possible used alongside Django? I've seen many live chat app tutorials that utilize Django channels and Redis but something like this would be perfect for what i'm looking for in my django project

  • @aaronpaterson7582
    @aaronpaterson7582 Pƙed 4 lety +3

    Hello everyone, I'm having an issue at 3:19 where you uses "npm run devStart" it get an error. Even though I did everything before correctly?
    HELP

  • @RobertWildling
    @RobertWildling Pƙed 4 lety +1

    Gotta love that intro!!! :-D

  • @Blu_Bear
    @Blu_Bear Pƙed 2 lety

    Hi WebDev! Really love the tutorials
    Out of curiosity, could you maybe go into a bit more depth on what you would need to do in order to make this site work remotely through other devices?
    Besides the basics of getting the site hosted, I'm not sure what to change in the js to get it running
    I'd really appreciate the help
    Although, considering the age of this video, It's not expected or anything
    Cheers!

    • @royz_1
      @royz_1 Pƙed 2 lety

      Just host it on a vps and it can be accessed from any device

  • @scottjohnnyhelgemoaune2951

    Is it possible to for example lock down the range so that everybody within 1 km can be a part of the chat? Like Jodel.

  • @surajvijay1937
    @surajvijay1937 Pƙed 3 lety +5

    "and that is going to be easy" - Quote of this video