mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
[ci skip] Fixed typos and grammatical errors in Action Cable Overview
This commit is contained in:
parent
b167d8e517
commit
0b99f02279
1 changed files with 10 additions and 10 deletions
|
@ -66,7 +66,7 @@ one per tab/device open to your connection).
|
||||||
### Pub/Sub
|
### Pub/Sub
|
||||||
|
|
||||||
[Pub/Sub](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) or
|
[Pub/Sub](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) or
|
||||||
Publish-Subscribe, refers to a message queue paradigm whereby senders of
|
Publish-Subscribe refers to a message queue paradigm whereby senders of
|
||||||
information (publishers), send data to an abstract class of recipients
|
information (publishers), send data to an abstract class of recipients
|
||||||
(subscribers), without specifying individual recipients. Action Cable uses this
|
(subscribers), without specifying individual recipients. Action Cable uses this
|
||||||
approach to communicate between the server and many clients.
|
approach to communicate between the server and many clients.
|
||||||
|
@ -83,14 +83,14 @@ Each channel can be streaming zero or more broadcastings.
|
||||||
|
|
||||||
For every WebSocket accepted by the server, a connection object is instantiated. This
|
For every WebSocket accepted by the server, a connection object is instantiated. This
|
||||||
object becomes the parent of all the *channel subscriptions* that are created
|
object becomes the parent of all the *channel subscriptions* that are created
|
||||||
from there on. The connection itself does not deal with any specific application
|
from thereon. The connection itself does not deal with any specific application
|
||||||
logic beyond authentication and authorization. The client of a WebSocket
|
logic beyond authentication and authorization. The client of a WebSocket
|
||||||
connection is called the connection *consumer*. An individual user will create
|
connection is called the connection *consumer*. An individual user will create
|
||||||
one consumer-connection pair per browser tab, window, or device they have open.
|
one consumer-connection pair per browser tab, window, or device they have open.
|
||||||
|
|
||||||
Connections are instances of `ApplicationCable::Connection`, which extends
|
Connections are instances of `ApplicationCable::Connection`, which extends
|
||||||
[`ActionCable::Connection::Base`][]. In `ApplicationCable::Connection`, you
|
[`ActionCable::Connection::Base`][]. In `ApplicationCable::Connection`, you
|
||||||
authorize the incoming connection, and proceed to establish it if the user can
|
authorize the incoming connection and proceed to establish it if the user can
|
||||||
be identified.
|
be identified.
|
||||||
|
|
||||||
#### Connection Setup
|
#### Connection Setup
|
||||||
|
@ -258,7 +258,7 @@ The connection won't be established until you've also specified at least one sub
|
||||||
you're interested in having.
|
you're interested in having.
|
||||||
|
|
||||||
The consumer can optionally take an argument that specifies the URL to connect to. This
|
The consumer can optionally take an argument that specifies the URL to connect to. This
|
||||||
can be a string, or a function that returns a string that will be called when the
|
can be a string or a function that returns a string that will be called when the
|
||||||
WebSocket is opened.
|
WebSocket is opened.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -399,7 +399,7 @@ consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, {
|
||||||
|
|
||||||
### Passing Parameters to Channels
|
### Passing Parameters to Channels
|
||||||
|
|
||||||
You can pass parameters from the client side to the server side when creating a
|
You can pass parameters from the client-side to the server-side when creating a
|
||||||
subscription. For example:
|
subscription. For example:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -711,7 +711,7 @@ production:
|
||||||
|
|
||||||
#### Adapter Configuration
|
#### Adapter Configuration
|
||||||
|
|
||||||
Below is a list of the subscription adapters available for end users.
|
Below is a list of the subscription adapters available for end-users.
|
||||||
|
|
||||||
##### Async Adapter
|
##### Async Adapter
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ The Redis adapter requires users to provide a URL pointing to the Redis server.
|
||||||
Additionally, a `channel_prefix` may be provided to avoid channel name collisions
|
Additionally, a `channel_prefix` may be provided to avoid channel name collisions
|
||||||
when using the same Redis server for multiple applications. See the [Redis PubSub documentation](https://redis.io/topics/pubsub#database-amp-scoping) for more details.
|
when using the same Redis server for multiple applications. See the [Redis PubSub documentation](https://redis.io/topics/pubsub#database-amp-scoping) for more details.
|
||||||
|
|
||||||
The Redis adapter also supports SSL/TLS connections. The required SSL/TLS parameters can be be passed in `ssl_params` key in the configuration yaml file.
|
The Redis adapter also supports SSL/TLS connections. The required SSL/TLS parameters can be passed in `ssl_params` key in the configuration yaml file.
|
||||||
|
|
||||||
```
|
```
|
||||||
production:
|
production:
|
||||||
|
@ -790,9 +790,9 @@ connections as you have workers. The default worker pool size is set to 4, so
|
||||||
that means you have to make at least 4 database connections available.
|
that means you have to make at least 4 database connections available.
|
||||||
You can change that in `config/database.yml` through the `pool` attribute.
|
You can change that in `config/database.yml` through the `pool` attribute.
|
||||||
|
|
||||||
### Client side logging
|
### Client-side logging
|
||||||
|
|
||||||
Client side logging is disabled by default. You can enable this by setting the `ActionCable.logger.enabled` to true.
|
Client-side logging is disabled by default. You can enable this by setting the `ActionCable.logger.enabled` to true.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
import * as ActionCable from '@rails/actioncable'
|
import * as ActionCable from '@rails/actioncable'
|
||||||
|
@ -836,7 +836,7 @@ You can use `ActionCable.createConsumer()` to connect to the cable
|
||||||
server if `action_cable_meta_tag` is invoked in the layout. Otherwise, A path is
|
server if `action_cable_meta_tag` is invoked in the layout. Otherwise, A path is
|
||||||
specified as first argument to `createConsumer` (e.g. `ActionCable.createConsumer("/websocket")`).
|
specified as first argument to `createConsumer` (e.g. `ActionCable.createConsumer("/websocket")`).
|
||||||
|
|
||||||
For every instance of your server you create and for every worker your server
|
For every instance of your server, you create and for every worker your server
|
||||||
spawns, you will also have a new instance of Action Cable, but the Redis or
|
spawns, you will also have a new instance of Action Cable, but the Redis or
|
||||||
PostgreSQL adapter keeps messages synced across connections.
|
PostgreSQL adapter keeps messages synced across connections.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue