-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ce27289
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the additional words.
So the return value is the name of a channel, and any clients that are subscribed to that channel name will get the action that we are processing server-side; is that right?
I will try making some statements to see if I understand correctly. In the example code, we will re-send this action to any user subscribed to the channel
'users/${userId}'
? That way anyone subscribed to the channel ofusers/${userId}
will get the action, and can re-compute the state client-side, from the action.The server in this way acts as a 'hub' in a fan-out type of message distribution, re-sending the message to anyone else that cares about it.
One other question — the example in the docs shows
resend
as a parameter toserver.type
method, but should this beserver.channel
?ce27289
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Yes
Yes
No.
server.type()
is a setting for each action. And you set channels for action inresend
.resend()
from example will be called only for actions like{ type: 'users/add', … }
ce27289
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, that is clear.
ce27289
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One part that was confusing to me was "marking all
users/add
actions as actions"A possible different wording:
ce27289
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. Can you send PR to save your name in the project history?
ce27289
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks; PR sent.