Skip to content

Commit 84fbedb

Browse files
author
Garrett Moseke
committed
remove websocket close on complete message according to protocol
1 parent 7da9b3a commit 84fbedb

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"repositoryURL": "https://github.com/apple/swift-nio.git",
5252
"state": {
5353
"branch": null,
54-
"revision": "154f1d32366449dcccf6375a173adf4ed2a74429",
55-
"version": "2.38.0"
54+
"revision": "6aa9347d9bc5bbfe6a84983aec955c17ffea96ef",
55+
"version": "2.33.0"
5656
}
5757
}
5858
]

Sources/GraphQLTransportWS/Server.swift

+2-6
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public class Server {
3030
/// - messenger: The messenger to bind the server to.
3131
/// - onExecute: Callback run during `subscribe` resolution for non-streaming queries. Typically this is `API.execute`.
3232
/// - onSubscribe: Callback run during `subscribe` resolution for streaming queries. Typically this is `API.subscribe`.
33-
/// - onExit: Callback run when the communication is shut down, either by the client or server
34-
/// - onMessage: callback run on receipt of any message
3533
public init(
3634
messenger: Messenger,
3735
onExecute: @escaping (GraphQLRequest) -> EventLoopFuture<GraphQLResult>,
@@ -148,7 +146,7 @@ public class Server {
148146
guard let self = self else { return }
149147
guard let streamOpt = result.stream else {
150148
// API issue - subscribe resolver isn't stream
151-
self.error(.internalAPIStreamIssue(errors: result.errors))
149+
self.sendError(result.errors, id: id)
152150
return
153151
}
154152
let stream = streamOpt as! ObservableSubscriptionEventStream
@@ -171,12 +169,11 @@ public class Server {
171169
onCompleted: { [weak self] in
172170
guard let self = self else { return }
173171
self.sendComplete(id: id)
174-
self.messenger?.close()
175172
}
176173
).disposed(by: self.disposeBag)
177174
}
178175
subscribeFuture.whenFailure { error in
179-
self.error(.graphQLError(error))
176+
self.sendError(error, id: id)
180177
}
181178
}
182179
else {
@@ -199,7 +196,6 @@ public class Server {
199196
self.error(.notInitialized())
200197
return
201198
}
202-
onExit()
203199
}
204200

205201
/// Send a `connection_ack` response through the messenger

0 commit comments

Comments
 (0)