@@ -41,7 +41,9 @@ yarn add laravel-echo-api-gateway
41
41
npn install --save laravel-echo-api-gateway
42
42
```
43
43
44
- ### When using Bref
44
+ ### Platform-specific instructions
45
+
46
+ #### A. When using Bref
45
47
46
48
Next, when using Bref, we have to add some elements to our ` serverless.yml ` file. If using Vapor, these resources have
47
49
to be created by hand using the AWS CLI or console.
@@ -146,11 +148,11 @@ return $app->make(Handler::class);
146
148
147
149
Now, deploy your app by running `serverless deploy` or similar. Write down the websocket url the output gives you.
148
150
149
- # ## When using Vapor
151
+ # ### B. When using Vapor
150
152
151
153
When using Vapor, you will have to create these required resources by hand using the AWS CLI or Console :
152
154
153
- # ### DynamoDB table for connections
155
+ # #### B1. DynamoDB table for connections
154
156
155
157
Create a DynamoDB table for the connections. Use `connectionId` (string) as a HASH key, and `channel` (string) as a SORT
156
158
key. Set the capacity setting to whatever you like (probably on-demand).
@@ -160,13 +162,13 @@ Create 2 indexes:
160
162
1. Name : ` lookup-by-connection` , key: `connectionId`, no sort key, projected: ALL
161
163
2. Name : ` lookup-by-channel` , key: `channel`, no sort key, projected: ALL
162
164
163
- # ### API Gateway
165
+ # #### B2. API Gateway
164
166
165
167
Create a new Websocket API. Enter a name and leave the route selection expression to what it is. Add a `$disconnect`
166
168
and `$default`. Set both integrations to `Lambda` and select your CLI lambda from the list. Set the name of the stage to
167
169
what you desire and create the API. Once created, write down the ID, as we'll need it later.
168
170
169
- # ### IAM Permissions
171
+ # #### B3. IAM Permissions
170
172
171
173
In IAM, go to roles and open `laravel-vapor-role`. Open the inline policy and edit it. On the JSON tab,
172
174
add `"execute-api:*"` to the list of actions.
@@ -183,7 +185,7 @@ LARAVEL_ECHO_API_GATEWAY_API_ID=your-websocket-api-id
183
185
LARAVEL_ECHO_API_GATEWAY_API_STAGE=your-api-stage-name
184
186
` ` `
185
187
186
- # ## For both Bref and Vapor
188
+ # ## Generate front-end code
187
189
188
190
Add to your javascript file :
189
191
0 commit comments