File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,17 @@ let params = "hello" // any Encodable
3535let response: Decodable = try await session.sendRequest (params, method : " my_method" )
3636
3737Task {
38- for await (request, handler, data) in session.requestSequence {
39- // inspect request, possibly re-decode with more specific type,
40- // and reply using the handler
41- }
42- }
43-
44- Task {
45- for await (notification, data) in session.notificationSequence {
46- // inspect notification
38+ for await event in await session.eventSequence {
39+ switch event {
40+ case .request (let request, let handler, let data):
41+ // inspect request, possibly re-decode with more specific type,
42+ // and reply using the handler
43+
44+ case .notification (let notification, let data):
45+ // inspect notification
46+ case .error (let error):
47+ print (" Error: \( error ) " )
48+ }
4749 }
4850}
4951```
You can’t perform that action at this time.
0 commit comments