You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-51Lines changed: 11 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,11 @@
2
2
3
3
# AnyCable Laravel Broadcaster
4
4
5
-
A Laravel broadcaster implementation to use [AnyCable](https://anycable.io/) as a WebSocket server.
6
-
7
-
The broadcaster allows you to use AnyCable as a drop-in replacement for Reverb, or Pusher, or whatever is supported by Laravel Echo. By "drop-in", we mean that no client-side changes required to use AnyCable, all you need is to update the server configuration (and, well, launch an AnyCable server).
5
+
A Laravel broadcaster implementation to use [AnyCable](https://anycable.io/) as a WebSocket server with Laravel Echo clients. For client-side integration, see [@anycable/echo][] package.
8
6
9
7
> [!TIP]
10
8
> The quickest way to get started with AnyCable server is to use our free managed offering: [plus.anycable.io](https://plus.anycable.io)
11
9
12
-
> [!NOTE]
13
-
> AnyCable Laravel support is still in its early days. Please, let us know if anything goes wrong. See also the [limitations](#limitations) section below.
14
-
15
10
## Requirements
16
11
17
12
- PHP 8.2+
@@ -57,51 +52,22 @@ That's a minimal configuration, all AnyCable related parameters would be inferre
57
52
]
58
53
```
59
54
60
-
Your client-sideEcho configuration can stay almost unchanged (in case you used Reverb):
55
+
On the client-side, configure Echo to use AnyCable adapter:
61
56
62
57
```js
63
58
importEchofrom"laravel-echo";
59
+
import { EchoCable } from"@anycable/echo";
64
60
65
-
// We use Pusher protocol for now
66
-
importPusherfrom"pusher-js";
67
-
window.Pusher= Pusher;
68
61
69
62
window.Echo=newEcho({
70
-
broadcaster:"reverb", // reverb or pusher would work
Just make sure you point to to the AnyCable server (locally it runs on the same host and port as Reverb). You must also **configure AnyCable to use the same app key** as `VITE_REVERB_APP_KEY`:
81
-
82
-
```sh
83
-
anycable-go --pusher-app-key=my-app-key
84
-
85
-
# or
86
-
ANYCABLE_PUSHER_APP_KEY=my-app-key anycable-go
87
-
```
88
-
89
-
To use public channels, make sure you have enabled them in AnyCable:
90
-
91
-
92
-
```sh
93
-
anycable-go --public_streams
94
-
95
-
# or full public mode
96
-
anycable-go --public
97
-
98
-
# or
99
-
ANYCABLE_PUBLIC_STREAMS=true anycable-go
100
-
101
-
# or
102
-
ANYCABLE_PUBLIC=true anycable-go
103
-
```
104
-
105
71
## Usage
106
72
107
73
You can use Laravel's broadcasting features as you normally would:
0 commit comments