Skip to content

Commit d6a4fe4

Browse files
authored
Add isOutboundHalfClosureEnabled: true to NIOAsyncChannel configuration (#104)
1 parent 7b91c26 commit d6a4fe4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Sources/HummingbirdWebSocket/WebSocketChannel.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ public struct HTTP1WebSocketUpgradeChannel: ServerChildChannel, HTTPChannelHandl
188188
},
189189
upgradePipelineHandler: { channel, handler in
190190
channel.eventLoop.makeCompletedFuture {
191-
let asyncChannel = try NIOAsyncChannel<WebSocketFrame, WebSocketFrame>(wrappingChannelSynchronously: channel)
191+
let asyncChannel = try NIOAsyncChannel<WebSocketFrame, WebSocketFrame>(
192+
wrappingChannelSynchronously: channel,
193+
configuration: .init(isOutboundHalfClosureEnabled: true)
194+
)
192195
return UpgradeResult.websocket(asyncChannel, handler, logger)
193196
}
194197
}
@@ -201,7 +204,10 @@ public struct HTTP1WebSocketUpgradeChannel: ServerChildChannel, HTTPChannelHandl
201204
[HTTP1ToHTTPServerCodec(secure: false)] + self.additionalChannelHandlers() + [HTTPUserEventHandler(logger: logger)]
202205
return channel.eventLoop.makeCompletedFuture {
203206
try channel.pipeline.syncOperations.addHandlers(childChannelHandlers)
204-
let asyncChannel = try NIOAsyncChannel<HTTPRequestPart, HTTPResponsePart>(wrappingChannelSynchronously: channel)
207+
let asyncChannel = try NIOAsyncChannel<HTTPRequestPart, HTTPResponsePart>(
208+
wrappingChannelSynchronously: channel,
209+
configuration: .init(isOutboundHalfClosureEnabled: true)
210+
)
205211
if upgradeAttempted.value {
206212
return UpgradeResult.failedUpgrade(asyncChannel, logger)
207213
} else {

0 commit comments

Comments
 (0)