Join Joseph LeBlanc for an in-depth discussion in this video Communicating with individual sockets, part of Node.js First Look.
- View Offline
- Exercise Files
Socket.io allows you to emit events to all of the socket connections at once or…you can emit an event to a specific socket.…In the case of a chat room we would like to greet a user upon login, but not…bother the other chatters with this message.…We'll also want to tell everyone once a chatter has left.…I've copied the chat_room folder from the exercise files onto my desktop.…We have dependencies to install.…So let's install them.…After the dependencies are installed let's have a look at server.js.…
We're still emitting the entrance event for A new chatters online, but now…we're meeting an entrance event for Welcome to the chat room!…This event is only being emitted to the socket that is currently connecting.…The other sockets will not see this message.…Also, we're assigning a function to the disconnect event that this socket might emit.…Whenever this socket disconnects we'll emit an event to all the other sockets in…the chat room saying that the chatter has disconnected.…
We're defining a new event type called exit.…
- Using the Socket.IO Node package to achieve "live" effects like Facebook notifications
- Scraping web sites using jQuery without a browser
Skill Level Beginner
XHTML and HTML Essential Trainingwith Bill Weinman4h 44m Beginner
1. Installing Node
2. Getting Started
Running a Node script2m 6s
4. Command Line Scripts
5. Creating Web Servers
7. WebSocket Programming
8. Connecting Beyond Node
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.