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
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -197,6 +197,28 @@ self.pusher.trigger(event: publicEvent) { result in
197
197
}
198
198
```
199
199
200
+
**NOTES:**
201
+
- The `trigger(…)` method is asynchronous. If you are not using this in a GUI application, you may need to use a semaphore:
202
+
203
+
```swift
204
+
let publicChannel =Channel(name: "my-channel", type: .public)
205
+
let publicEvent =try!Event(name: "my-event",
206
+
data: "hello world!",
207
+
channel: publicChannel)
208
+
209
+
let sema =DispatchSemaphore(value: 0)
210
+
pusher.trigger(event: publicEvent) { result in
211
+
switch result {
212
+
case .success(let channelSummaries):
213
+
// Inspect `channelSummaries
214
+
case .failure(let error):
215
+
// Handle error
216
+
}
217
+
sema.signal()
218
+
}
219
+
sema.wait()
220
+
```
221
+
200
222
### Authenticating channel subscriptions
201
223
202
224
Users that attempt to subscribe to a private or presence channel must be first authenticated. An authentication token that can be returned to a user client that is attempting a subscription, which requires authentication with the server.
0 commit comments