WebSockets with NodeJS (Express) and WebSocket API

How to set up a WebSockets Client and Server and Connect them!
-------------------------------------
Code: github.com/Vuka951/tutorial-c...
WebSocket API:
* developer.mozilla.org/en-US/d...
* developer.mozilla.org/en-US/d...
WS (WebSocket): www.npmjs.com/package/ws
--------------------------------------
Thanks for watching, if the video was helpful to you a like and/or a star to the github repo would be appreciated ❤️

Пікірлер: 57

  • @KeiAKWs
    @KeiAKWs7 ай бұрын

    Spent the whole day today to follow a 2 hours turorial on a web-socket-application and it didn't work, and I could't find the bug. And it felt like I didn't even understand what exactly I was coding on each line. This helped me capture it better. Thank you.

  • @PabloGnesutta
    @PabloGnesutta3 жыл бұрын

    This is SO GREAT man. Exactly the amount of data necessary and the amount of pointing where to find out more. Great flow, very dense in information. Thank you.

  • @SkanRideAdmin
    @SkanRideAdmin Жыл бұрын

    I was struggling to get some concise guideline on this as an entry level coder and you made my day.

  • @jensvandenberghe3762
    @jensvandenberghe37628 ай бұрын

    I've have been looking for an explanation on how to use websockets for 5 hours. I've been losing my mind about the amount of unclear explanations there were. You just saved my day and also my sanity. Thank you

  • @involuntaryoccupant
    @involuntaryoccupant4 жыл бұрын

    After 4 days of torture I finally find your video. Simple and easy. You are the best, man.

  • @vuka951

    @vuka951

    4 жыл бұрын

    Glad it was helpful!

  • @tudorstanciulescu9914
    @tudorstanciulescu99143 жыл бұрын

    bro, finally someone who explained this websocket communication right for beginnerrs. Thx a lot! u saved my project

  • @distinguishedy
    @distinguishedy3 жыл бұрын

    Thanks man, this simple explanation really helped with cramping websockets into my vue project.

  • @HermanRas
    @HermanRas2 жыл бұрын

    Huge thanks ! this was exactly what I needed ! the very bare bones approach to WS.

  • @swag2315
    @swag2315 Жыл бұрын

    thanks bro I overcomplicated things but this really helped me understand

  • @proengineer4250
    @proengineer42503 жыл бұрын

    You are awesome, amazing and marvelous. This is a fantastic tutorial.

  • @maurinoferreira6184
    @maurinoferreira61842 ай бұрын

    How isn't possible leave more than one like on this awsome video ?

  • @user-dc7oj3el7o
    @user-dc7oj3el7o3 жыл бұрын

    Have been so much help, thanks a lot!

  • @gaurangvishnoi8995
    @gaurangvishnoi89952 жыл бұрын

    wow... that was smooth... it will help me tomorrow but thank you today.

  • @tathagat9586
    @tathagat9586 Жыл бұрын

    Thank you, great work. It's very helpful

  • @lavoe574
    @lavoe5743 жыл бұрын

    How do you use the same express port in ws?

  • @programmerjadul2648
    @programmerjadul26483 жыл бұрын

    how to authentication and authorization using jwt in websocket ws

  • @bryandandan5443
    @bryandandan54432 жыл бұрын

    Great tutorial. One question though, how can you send to specific client?

  • @garrin5922
    @garrin59222 жыл бұрын

    Websocket Update: Add another parameter, in ws.on('message'... called isBinary for sending to other clients excluding itself because they will be encrypted if I'm not mistaken. Kinda like this ws.on('message', function message(data, isBinary) { wss.clients.forEach(function each(client) { if (client !== ws && client.readyState === WebSocket.OPEN) { client.send(data, { binary: isBinary }); } });

  • @SachinABS
    @SachinABS Жыл бұрын

    very clear explanation.

  • @tudorstanciulescu9914
    @tudorstanciulescu99143 жыл бұрын

    For example if i want to send some data from server to client, but in a custom event. on the server side, in connection event i need to send the event, like wss.on('connection', function connection(ws){ ws.send('myCustomEvent', someData); }); and in the client side i just need to add an event listener to receive that custom event? socket.addEventListener('myCustomEvent', (data) => { console.log(data.data) })

  • @prashantdhawase8057
    @prashantdhawase80573 жыл бұрын

    very nice video short sweet and explained very well thanks :)

  • @GiulioAndCode
    @GiulioAndCode2 жыл бұрын

    Thanks, great video!🔥 I use this in future video tutorial in my yt channel

  • @jeetchheda8916
    @jeetchheda8916 Жыл бұрын

    Can We Uniquely Identify this client ? And Do some Action based on which client closed the Connection ??

  • @HarshaSagarKV
    @HarshaSagarKV Жыл бұрын

    Helped a Lot !!!!!

  • @harymk
    @harymk3 жыл бұрын

    how can use this method to firebase web hosting

  • @magickomchanell4556
    @magickomchanell45565 ай бұрын

    Before recording, I suggest increasing your vscode font to 17-20, it will really help us, thank you

  • @johnyepthomi892
    @johnyepthomi8923 жыл бұрын

    bingo you’re awesome dude!

  • @AjayKumar-pl5st
    @AjayKumar-pl5st Жыл бұрын

    i tried the same code but in client side instead of showing hello from client1 its showing blob{size:19 type:" "} if u know how to solve the issue kindly let me know

  • @eqisoftcom
    @eqisoftcom4 жыл бұрын

    Very useful, thank you!

  • @vuka951

    @vuka951

    3 жыл бұрын

    Glad to hear that!

  • @ShaneBoiGaming
    @ShaneBoiGaming7 ай бұрын

    I like the console group chart!

  • @mfAdvice
    @mfAdvice10 ай бұрын

    Sir my websocket url require authentication how to connect. Please share some code or video

  • @mohammedelghazal6077
    @mohammedelghazal60772 жыл бұрын

    How can use it in real server hosting ??

  • @nicetomeetugaming7024
    @nicetomeetugaming70242 жыл бұрын

    Thanks a lot sir!

  • @yashpreetbathla4653
    @yashpreetbathla46533 жыл бұрын

    amazing man thanks alot :)

  • @vuka951

    @vuka951

    3 жыл бұрын

    Glad it helped!

  • @rizzy5652
    @rizzy56522 жыл бұрын

    Nice video thanks

  • @chihabahmed5207
    @chihabahmed52073 жыл бұрын

    how do you save all connections I know when the user make a connection we can have an array such as const user = [] then we push each socket and user id from our front end, in case someone logs in to our server with jwt and gets the his user profile such as { id: xxxx, name: asss, email:add@hotmail.com} so we can push the user id or his email (unique) to that array along side the socket correct. can we store them in redis and if a connections is lost we can update that socket in redis ? or how do you go about implementing this thanks

  • @bprincepandey
    @bprincepandey2 жыл бұрын

    great video

  • @ramadanmusa3116
    @ramadanmusa3116 Жыл бұрын

    hello friend..i get the error when running a node index.js file const wss = new WebSocket.Server({ server:server }); ^ TypeError: WebSocket.Server is not a constructor

  • @bigbadcatbigbcy2933
    @bigbadcatbigbcy29334 ай бұрын

    good video

  • @normajeanchariot
    @normajeanchariot3 жыл бұрын

    why do you have to open the file directly? I want to navigate to port 3000 not open file with browser. I copied example from npm ws word for word and then copied the websocket browser example from mozilla developer word for word and it doesnt work. My browser goes into infinite load.

  • @ramsantosh6268

    @ramsantosh6268

    2 жыл бұрын

    did you find the solution for opening the page in localhost:3000 (any port number)

  • @AfroDemoz
    @AfroDemoz Жыл бұрын

    wooooooza i like hardcore codding thou I am not that good so keep the good vibe going

  • @rodrigocardoso126
    @rodrigocardoso126Ай бұрын

    I need help

  • @prenomnom5637
    @prenomnom56373 жыл бұрын

    good video. it could have been better if you used a bigger font, but great video anyways.

  • @axeleli6845
    @axeleli68453 жыл бұрын

    thank you

  • @lutfiikbalmajid3128
    @lutfiikbalmajid31282 жыл бұрын

    i like for the topics and explanation, i dislike for readibility, the text to small, you need to zoom it later

  • @dhawalparmar7117
    @dhawalparmar71172 жыл бұрын

    Next time please increase font size

  • @zsar_official
    @zsar_official3 жыл бұрын

    What is the difference between ws and websocket ?? I'm really confused

  • @nclsDesign

    @nclsDesign

    3 жыл бұрын

    Two different libraries but both with the dame basic function

  • @zsar_official

    @zsar_official

    3 жыл бұрын

    @@nclsDesign I figured, in a month

  • @thenextbigthing1393

    @thenextbigthing1393

    2 жыл бұрын

    @@nclsDesign I think its not dame.

  • @nclsDesign

    @nclsDesign

    2 жыл бұрын

    @@thenextbigthing1393 Not the same but the SAME BASIC FUNCTION, as I said.

  • @heitormbonfim
    @heitormbonfim2 жыл бұрын

    Bruh, next time add some zoom, I can't see that well

Келесі