Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lessons 30-33 #1

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open

Lessons 30-33 #1

wants to merge 37 commits into from

Conversation

gjaldon
Copy link

@gjaldon gjaldon commented Sep 16, 2016

No description provided.

samcorcos and others added 6 commits September 14, 2016 07:17
We listen to the presence_state and presence_diff events
so we can keep track of and sync presences in the frontend.
We then store these presences in our Chat component's
state. That way, our component will rerender when
presences' state changes. We pass these presences to
Sidebar, which is a stateless functional component, and
only deals with rendering of the presences.
An admin can now click on a user on the sidebar and
view messages from that user. A user can send messages
and the admin will receive them in real-time. Since
our messages are already persisted in the DB, admin
will be able to see them every time they join a chatroom.

Next, we will need admin to be able to respond to users.
We handle input entered by admin and send the input to
the backend on when they press 'Enter'. Since we already
have the logic in place for sending this message to all
members of a room, the user will receive this message
once it has been saved and broadcast by our server.
The host for our JSON API and Websocket servers will
be different in our production environment. This needs
to be configurable. In Webpack, we can define values
during build time which can be configured to be different
depending on your environment. Later on, we will add
a webpack config specifically for production so we can
easily create a production build and deploy it.
Using presences alone to populate admin's sidebar
doesn't allow us to see inactive users. To deal with
this, we populate our list with users that we store in
our server. Since our server passes a list of anonymous
users when we connect to admin:active_users, we can use
this list to fill up our sidebar with an initial list
of users.

To handle updating this list, we listen to the lobby_list
event. Through this event, the server will pass us users
that have connected to our app. Once connected, we check
if that user exists in our list and add them if they
are new.
@gjaldon gjaldon changed the title Lesson 30 Lessons 30-33 Sep 16, 2016
@gjaldon
Copy link
Author

gjaldon commented Sep 16, 2016

The commits and what lessons they are related to:

a428d52

858b697

1ae6940

641ea22

fa7ca11

@samcorcos samcorcos force-pushed the master branch 2 times, most recently from 741591c to d974508 Compare September 20, 2016 07:02
@samcorcos samcorcos force-pushed the master branch 2 times, most recently from ca9af74 to 7f11a9f Compare September 22, 2016 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants