From 8e7d9ce8cbed06e477d9bd4d0e4be9abc2a66cf8 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sun, 13 Jan 2019 19:31:43 +0000 Subject: Merge `actioncable/README.md` to the Action Cable Overview guide [ci skip] In #34709 we updated the guide, but `actioncable/README.md` is still outdated. Instead of fixing content in the file. I suggest not duplicate the info that is already in the guide and instead remove the info from the file and just add a message: "You can read more about Action Cable in the [Action Cable Overview](https://edgeguides.rubyonrails.org/action_cable_overview.html) guide." The same approach is being used for Action Mailbox and Action Text, see #34812 and #34878. --- guides/source/action_cable_overview.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'guides') diff --git a/guides/source/action_cable_overview.md b/guides/source/action_cable_overview.md index 77a1b73bae..9cfa51f6d8 100644 --- a/guides/source/action_cable_overview.md +++ b/guides/source/action_cable_overview.md @@ -27,6 +27,36 @@ client-side JavaScript framework and a server-side Ruby framework. You have access to your full domain model written with Active Record or your ORM of choice. +Terminology +----------- + +A single Action Cable server can handle multiple connection instances. It has one +connection instance per WebSocket connection. A single user may have multiple +WebSockets open to your application if they use multiple browser tabs or devices. +The client of a WebSocket connection is called the consumer. + +Each consumer can in turn subscribe to multiple cable channels. Each channel +encapsulates a logical unit of work, similar to what a controller does in +a regular MVC setup. For example, you could have a `ChatChannel` and +an `AppearancesChannel`, and a consumer could be subscribed to either +or to both of these channels. At the very least, a consumer should be subscribed +to one channel. + +When the consumer is subscribed to a channel, they act as a subscriber. +The connection between the subscriber and the channel is, surprise-surprise, +called a subscription. A consumer can act as a subscriber to a given channel +any number of times. For example, a consumer could subscribe to multiple chat rooms +at the same time. (And remember that a physical user may have multiple consumers, +one per tab/device open to your connection). + +Each channel can then again be streaming zero or more broadcastings. +A broadcasting is a pubsub link where anything transmitted by the broadcaster is +sent directly to the channel subscribers who are streaming that named broadcasting. + +As you can see, this is a fairly deep architectural stack. There's a lot of new +terminology to identify the new pieces, and on top of that, you're dealing +with both client and server side reflections of each unit. + What is Pub/Sub --------------- -- cgit v1.2.3