嗨,幫派,在此網路套接字教程中,我將向您展示如何發出消息(均來自客戶端和伺服器),然後接收消息(均在客戶端和伺服器上)。這樣,我們就可以開始充實我們的聊天應用程序了:)
—–課程鏈接:
+回購-https://github.com/iamshaunjp/websockets-playlist
+ Atom編輯器-https://atom.io/a
+下載節點-https://nodejs.org/en/
+ Socket.io-https://socket.io
————————————————– ——————————————-
相關教程:
—– NODE.JS教程
—–訂閱頻道-https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1
==============網路忍者=====================
有關更多的前端開發教程並精通您的編碼技能,請訪問-https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg或http://thenetninja.co.uk
==================社交鏈接==================
Twitter-@TheNetNinja-https://twitter.com/thenetninjauk
11:22 instead of using the pluses can u use `<p><strong>${data.handle}<strong><p>` ??
Hi I hav an error Get socket.io?EIO=3TRANSOORT…..404 while hosting in cpanel..
but what if we don't want to broadcast the message, just private chat..?
I tried different tutorials to get into making servers with nodejs and I actually worked on nodejs servers in my previous job and this tutorial still opened my eyes for a lot of things. It is the first time I think I really understand how to do it.
So once that is all complete, how would you embed that into a website on WordPress?
What i need to change in order for this to work on actually site, what i need to put on site and where should i put it on site?
how can u change a global variable in the socket.on event listener?
great tutorial… btw
from where i get the code? in repo i cant find it
Never took the trouble to comment on a video before but dang. These videos are some other quality than any video I have ever seen, my compliments and keep up the good work!
Made an account just to be able to comment. Amazing tutorial man! Great structure and good and easy to understand explanations. Quality Content! Keep it up man. Subscribed!
How do you get the CSS code for the style
Hi,
I tried your code, now I am trying to deploy it, but it's not happening,
I already made the io.connect('from localHost to deployed link')
what to do any suggestions ??
and please response asap.
nodemon is consoling socket.on is not a function
Great tutorial, I saw in another of your videos you talked about events nodejs module, which would be the difference between the event Emitter and socket.io?
Thanks
You might wan't to put form elements in an actual form, some browser don't render form elements outside a form.
use this, its more recent: https://socket.io/get-started/chat
code doesnt work, its outdated
Can you define what is io and what is socket??
Thank you 😀
Thank you so much.
You sir are a gentleman and a scholar.
Thank You
I feel like I should be paying this dude…
You are AMAZING! You're so good at explaining things, and I can't be thankful enough that you made this series available for free on YouTube!
is it the best way? what if the link of socket.io changes or someone mess with it or put a virus in it? why not hard coding whatever is inside the socket.io.js into the browser? I assume nobody refers to a link in a real application
It's weird but the thought comes to mind that a company was sold for $ 19.2B which essentially provides superior chat messaging experience and is based on a technology which in bare bones elementary level is as simple as this 14 min video.
Sir …. I've successfully established the connection and all my codes on client as well as on server is same as yours … inspite of that I'm not able to display messages..
Plzzz help me out
Bro, I seriously appreciate your work. It has been awesome and thanks a lot. If only there were people who could explain as good as you.
So you double checked for errors and it's still not working? In chat.js, change var socket = io.connect('http://localhost/4000); to var socket = io();
OMG you are amazing
When I spent half an hour looking for my mistake in my code, and realized my innerHTML was capitalized…
woooo?
@4:35 not that it matters, but, after line 5 the rest of the variables are declared globally. The reason is because after the 'message' you closed it with a semicolon and the rest of them aren't declared with var, let, or const, so they are placed globally (as you know sean). But for this small app it doesn't really matter.
very nice. superb. @Pawel Rafalko 's comment is important too
Please say. What font do you use?
this is so well broken down, thank you
Who disliked this video? 5 people, huh?? why? he teaches it way better than almost all videos i've come across.
Followed the same code and the button didn't work but did the following debug:
1) Console.log inside the button worked
2) Could Access the DOM.value content
3) Considering those points the problema had to be in the socketio methods/functions
4) I researched a little bit in the documentation of socket.io and what realized is they use "var socket = io();" instead of "var socket = io.connect('http://localhost/…);". With that change started working for me.Also changing in the server configuratio "io.socket.emit(…)" to "io.emit(…);" as most comments suggested.
As a french, I feel like I hear Tyson Fury who talk about socket.io 🙂
By the way, nice job, thx !
Man I was struggling so hard with all this socket data stuff and then i bumped into your tutorial. Thanks a lot you really explained it clearly here!
Thanks a lot for an amazing tutorials!
This was the "Ah-Ha" video
For those who encountered a problem with a message not showing in the div, try to change the port number from 4000 to 4001 or something else, and type again in the cmder "nodemon index", worked for me
where is the source code?