Skip to content

Commit a362c83

Browse files
Merge pull request rails#23944 from prathamesh-sonpatki/ac-guide-fixes
Fix typos in Action Cable guide [ci skip]
2 parents 4eaaced + 2ff6358 commit a362c83

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

guides/source/action_cable_overview.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ client-server connection instance established per WebSocket connection.
3535
## Server-Side Components
3636

3737
### Connections
38-
Connections form the foundaton of the client-server relationship. For every WebSocket
38+
Connections form the foundation of the client-server relationship. For every WebSocket
3939
the cable server is accepting, a Connection object will be instantiated. This instance
40-
becomes the parent of all the channel subscriptions that are created from there on.
40+
becomes the parent of all the channel subscriptions that are created from there on.
4141
The Connection itself does not deal with any specific application logic beyond authentication
42-
and authorization. The client of a WebSocket connection is called the consumer.
42+
and authorization. The client of a WebSocket connection is called the consumer.
4343
A single consumer may have multiple WebSockets open to your application if they
44-
use multiple browser tabs or devices.
44+
use multiple browser tabs or devices.
4545

4646
Connections are instantiated via the `ApplicationCable::Connection` class in Ruby.
4747
In this class, you authorize the incoming connection, and proceed to establish it
@@ -75,7 +75,7 @@ Note that anything marked as an identifier will automatically create a delegate
7575
by the same name on any channel instances created off the connection.
7676

7777
This relies on the fact that you will already have handled authentication of the user,
78-
and that a successful authentication sets a signed cookie with the `user_id`.
78+
and that a successful authentication sets a signed cookie with the `user_id`.
7979
This cookie is then automatically sent to the connection instance when a new connection
8080
is attempted, and you use that to set the `current_user`. By identifying the connection
8181
by this same current_user, you're also ensuring that you can later retrieve all open
@@ -84,9 +84,9 @@ or deauthorized).
8484

8585
### Channels
8686
A channel encapsulates a logical unit of work, similar to what a controller does in a
87-
regular MVC setup.
87+
regular MVC setup.
8888
By default, Rails creates a parent `ApplicationCable::Channel` class for encapsulating
89-
shared logic between your channels.
89+
shared logic between your channels.
9090

9191
#### Parent Channel Setup
9292
```ruby
@@ -145,11 +145,11 @@ This ensures that the signed cookie will be correctly sent.
145145

146146
#### Subscriber
147147
When a consumer is subscribed to a channel, they act as a subscriber. A
148-
consumer can act as a subscriber to a given channel any number of times.
149-
For example, a consumer could subscribe to multiple chat rooms at the same time.
148+
consumer can act as a subscriber to a given channel any number of times.
149+
For example, a consumer could subscribe to multiple chat rooms at the same time.
150150
(remember that a physical user may have multiple consumers, one per tab/device open to your connection).
151151

152-
A consumer becomes a subscriber, by creating a subscribtion to a given channel:
152+
A consumer becomes a subscriber, by creating a subscription to a given channel:
153153
```coffeescript
154154
# app/assets/javascripts/cable/subscriptions/chat.coffee
155155
# Assumes you've already requested the right to send web notifications
@@ -197,8 +197,8 @@ end
197197

198198
A broadcasting is a pub/sub link where anything transmitted by a publisher
199199
is routed directly to the channel subscribers who are streaming that named
200-
broadcasting. Each channel can be streaming zero or more broadcastings.
201-
Broadcastings are purely an online queue and time dependent;
200+
broadcasting. Each channel can be streaming zero or more broadcastings.
201+
Broadcastings are purely an online queue and time dependent;
202202
If a consumer is not streaming (subscribed to a given channel), they'll not
203203
get the broadcast should they connect later.
204204

@@ -218,9 +218,9 @@ callback.
218218

219219
### Subscriptions
220220

221-
When a consumer is subscribed to a channel, they act as a subscriber;
221+
When a consumer is subscribed to a channel, they act as a subscriber;
222222
This connection is called a subscription. Incoming messages are then routed
223-
to these channel subscriptions based on an identifier sent by the cable consumer.
223+
to these channel subscriptions based on an identifier sent by the cable consumer.
224224

225225
```coffeescript
226226
# app/assets/javascripts/cable/subscriptions/chat.coffee
@@ -414,13 +414,13 @@ App.cable.subscriptions.create "AppearanceChannel",
414414
The appearance example was all about exposing server functionality to
415415
client-side invocation over the WebSocket connection. But the great thing
416416
about WebSockets is that it's a two-way street. So now let's show an example
417-
where the server invokesan action on the client.
417+
where the server invokes an action on the client.
418418

419419
This is a web notification channel that allows you to trigger client-side
420420
web notifications when you broadcast to the right streams:
421421

422422
#### Create the server-side Web Notifications Channel:
423-
423+
424424
```ruby
425425
# app/channels/web_notifications_channel.rb
426426
class WebNotificationsChannel < ApplicationCable::Channel
@@ -520,12 +520,12 @@ this would be something like: `App.cable = ActionCable.createConsumer("ws://exam
520520
and for an in-app server, something like: `App.cable = ActionCable.createConsumer("/cable")`.
521521

522522
The second option is to pass the server url through the `action_cable_meta_tag` in your layout.
523-
This uses a url or path typically set via `config.action_cable.url`
523+
This uses a url or path typically set via `config.action_cable.url`
524524
in the environment configuration files, or defaults to "/cable".
525525

526526
This method is especially useful if your WebSocket url might change
527527
between environments. If you host your production server via https,
528-
you will need to use the wss scheme for your ActionCable server, but
528+
you will need to use the wss scheme for your ActionCable server, but
529529
development might remain http and use the ws scheme. You might use localhost
530530
in development and your domain in production.
531531

@@ -606,15 +606,15 @@ end
606606

607607
You can use `App.cable = ActionCable.createConsumer()` to connect to the
608608
cable server if `action_cable_meta_tag` is included in the layout. A custom
609-
path is specified as first argument to `createConsumer`
609+
path is specified as first argument to `createConsumer`
610610
(e.g. `App.cable = ActionCable.createConsumer("/websocket")`).
611611

612612
For every instance of your server you create and for every worker
613613
your server spawns, you will also have a new instance of ActionCable,
614-
but the use of Redis keeps messages synced across connections.
614+
but the use of Redis keeps messages synced across connections.
615615

616616
### Standalone
617-
The cable server(s) can be separated from your normal application server.
617+
The cable server(s) can be separated from your normal application server.
618618
It's still a Rack application, but it is its own Rack application.
619619
The recommended basic setup is as follows:
620620

@@ -639,7 +639,7 @@ The above will start a cable server on port 28080.
639639
Beware that currently the cable server will _not_ auto-reload any
640640
changes in the framework. As we've discussed, long-running cable
641641
connections mean long-running objects. We don't yet have a way of
642-
reloading the classes of those objects in a safe manner. So when
642+
reloading the classes of those objects in a safe manner. So when
643643
you change your channels, or the model your channels use, you must
644644
restart the cable server.
645645

@@ -660,11 +660,11 @@ The Ruby side of things is built on top of [websocket-driver](https://github.com
660660
## Deployment
661661

662662
Action Cable is powered by a combination of WebSockets and threads. Both the
663-
framework plumbing and user-specified channel work are handled internally by
664-
utilizing Ruby's native thread support. This means you can use all your regular
663+
framework plumbing and user-specified channel work are handled internally by
664+
utilizing Ruby's native thread support. This means you can use all your regular
665665
Rails models with no problem, as long as you haven't committed any thread-safety sins.
666666

667-
The Action Cable server implements the Rack socket hijacking API,
667+
The Action Cable server implements the Rack socket hijacking API,
668668
thereby allowing the use of a multithreaded pattern for managing connections
669669
internally, irrespective of whether the application server is multi-threaded or not.
670670

0 commit comments

Comments
 (0)