Join Alex Banks for an in-depth discussion in this video Broadcasting speaker data, part of Building a Polling App with Socket IO and React.js.
- Once the presentation has started we will have the speaker…name in the presentation title saved to our state variables…on the server.…We now need to take that data and broadcast it…to the client and make sure that the client state…is in sync with the server state.…So, let's start with the app server file.…If you notice up here on lines 6,7, and 8…these are the three variables in our app server file…that represent application state.…Now, when a user connects to this socket they are welcomed…with the title, but really when a user connects we need…to send all three of these state variables to the client.…
So, what I'm gonna do is I'm gonna scroll down here…and find that welcome event.…So, on line 54 we emit a welcome event and we are passing…the current title, but we should also pass the current…audience and the current speaker.…Now, you might be tempted to just pass the speaker object,…but all of the clients don't need to know what that speaker…socket ID is, the only information that we actually need…is the speaker's name.…
- Setting up the environment
- Connecting sockets
- Handling disconnects
- Setting up the React.js router
- Passing state to child components as properties
- Joining the presentation
- Starting and running the presentation
- Asking and answering questions
- Graphing results
- Upgrading to ES6
Skill Level Intermediate
1. Setting Up the Environment
Setting up npm scripts4m 22s
2. Connecting Sockets
3. App State and Routes
4. Joining the Presentation
5. Starting the Presentation
6. Questions and Answers
7. Graphing Results on a Scoreboard
8. Upgrading to ES6 Syntax
Next steps1m 1s
- 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.