Skip to content

Commit

Permalink
2024/03/18までの原文変更点反映。
Browse files Browse the repository at this point in the history
  • Loading branch information
HiroKws committed Mar 18, 2024
1 parent 188cb39 commit 4ad6a07
Show file tree
Hide file tree
Showing 12 changed files with 682 additions and 20 deletions.
58 changes: 57 additions & 1 deletion original-en/broadcasting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
- [Introduction](#introduction)
- [Server Side Installation](#server-side-installation)
- [Configuration](#configuration)
- [Reverb](#reverb)
- [Pusher Channels](#pusher-channels)
- [Ably](#ably)
- [Open Source Alternatives](#open-source-alternatives)
- [Client Side Installation](#client-side-installation)
- [Reverb](#client-reverb)
- [Pusher Channels](#client-pusher-channels)
- [Ably](#client-ably)
- [Concept Overview](#concept-overview)
Expand Down Expand Up @@ -52,7 +54,7 @@ The core concepts behind broadcasting are simple: clients connect to named chann
<a name="supported-drivers"></a>
#### Supported Drivers

By default, Laravel includes two server-side broadcasting drivers for you to choose from: [Pusher Channels](https://pusher.com/channels) and [Ably](https://ably.com). However, community driven packages such as [soketi](https://docs.soketi.app/) provide additional broadcasting drivers that do not require commercial broadcasting providers.
By default, Laravel includes three server-side broadcasting drivers for you to choose from: [Laravel Reverb](https://reverb.laravel.com), [Pusher Channels](https://pusher.com/channels), and [Ably](https://ably.com).

> [!NOTE]
> Before diving into event broadcasting, make sure you have read Laravel's documentation on [events and listeners](/docs/{{version}}/events).
Expand All @@ -79,6 +81,23 @@ Before broadcasting any events, you will first need to register the `App\Provide

You will also need to configure and run a [queue worker](/docs/{{version}}/queues). All event broadcasting is done via queued jobs so that the response time of your application is not seriously affected by events being broadcast.

<a name="reverb"></a>
### Reverb

You may install Reverb using the Composer package manager. Since Reverb is currently in beta, you will need to explicitly install the beta release:

```sh
composer require laravel/reverb:@beta
```

Once the package is installed, you may run Reverb's installation command to publish the configuration, update your applications's broadcasting configuration, and add Reverb's required environment variables:

```sh
php artisan reverb:install
```

You can find detailed Reverb installation and usage instructions in the [Reverb documentation](/docs/{{version}}/reverb).

<a name="pusher-channels"></a>
### Pusher Channels

Expand Down Expand Up @@ -149,6 +168,43 @@ Finally, you are ready to install and configure [Laravel Echo](#client-side-inst
<a name="client-side-installation"></a>
## Client Side Installation

<a name="client-reverb"></a>
### Reverb

[Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. You may install Echo via the NPM package manager. In this example, we will also install the `pusher-js` package since Reverb utilizes the Pusher protocol for WebSocket subscriptions, channels, and messages:

```shell
npm install --save-dev laravel-echo pusher-js
```

Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. A great place to do this is at the bottom of the `resources/js/bootstrap.js` file that is included with the Laravel framework. By default, an example Echo configuration is already included in this file - you simply need to uncomment it and update the `broadcaster` configuration option to `reverb`:

```js
import Echo from 'laravel-echo';

import Pusher from 'pusher-js';
window.Pusher = Pusher;

window.Echo = new Echo({
broadcaster: 'reverb',
key: import.meta.env.VITE_REVERB_APP_KEY,
wsHost: import.meta.env.VITE_REVERB_HOST,
wsPort: import.meta.env.VITE_REVERB_PORT,
wssPort: import.meta.env.VITE_REVERB_PORT,
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws', 'wss'],
});
```
Next, you should compile your application's assets:
```shell
npm run build
```
> [!WARNING]
> The Laravel Echo `reverb` broadcaster requires laravel-echo v1.16.0+.
<a name="client-pusher-channels"></a>
### Pusher Channels
Expand Down
8 changes: 0 additions & 8 deletions original-en/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,6 @@ To set configuration values at runtime, you may invoke the `Config` facade's `se

config(['app.timezone' => 'America/Chicago']);

To assist with static analysis, the `Config` facade also provides typed configuration retrieval methods. If the retrieved configuration value does not match the expected type, an exception will be thrown:

Config::string('config-key');
Config::integer('config-key');
Config::float('config-key');
Config::boolean('config-key');
Config::array('config-key');

<a name="configuration-caching"></a>
## Configuration Caching

Expand Down
1 change: 1 addition & 0 deletions original-en/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
- [Precognition](/docs/{{version}}/precognition)
- [Prompts](/docs/{{version}}/prompts)
- [Pulse](/docs/{{version}}/pulse)
- [Reverb](/docs/{{version}}/reverb)
- [Sail](/docs/{{version}}/sail)
- [Sanctum](/docs/{{version}}/sanctum)
- [Scout](/docs/{{version}}/scout)
Expand Down
2 changes: 1 addition & 1 deletion original-en/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Before creating your first Laravel project, make sure that your local machine ha
After you have installed PHP and Composer, you may create a new Laravel project via Composer's `create-project` command:

```nothing
composer create-project laravel/laravel example-app
composer create-project laravel/laravel:^10.0 example-app
```

Or, you may create new Laravel projects by globally installing [the Laravel installer](https://github.com/laravel/installer) via Composer:
Expand Down
Loading

0 comments on commit 4ad6a07

Please sign in to comment.