Skip to content

Commit

Permalink
Remove pong function
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Nov 5, 2024
1 parent b1a3bd3 commit eeaca0b
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions Sources/HummingbirdWSCore/WebSocketHandler.swift
Original file line number Diff line number Diff line change
@@ -74,7 +74,6 @@ package actor WebSocketHandler {
}
}

static let pingDataSize = 16
let channel: Channel
var outbound: NIOAsyncChannelOutboundWriter<WebSocketFrame>
let type: WebSocketType
@@ -241,7 +240,7 @@ package actor WebSocketHandler {
}
switch self.stateMachine.receivedPing(frameData: frame.unmaskedData) {
case .pong(let frameData):
try await self.pong(data: frameData)
try await self.write(frame: .init(fin: true, opcode: .pong, data: frameData))

case .doNothing:
break
@@ -253,12 +252,6 @@ package actor WebSocketHandler {
self.stateMachine.receivedPong(frameData: frame.unmaskedData)
}

/// Send pong
func pong(data: ByteBuffer?) async throws {
guard case .open = self.stateMachine.state else { return }
try await self.write(frame: .init(fin: true, opcode: .pong, data: data ?? .init()))
}

/// Send close
func close(code: WebSocketErrorCode = .normalClosure, reason: String? = nil) async throws {
switch self.stateMachine.close() {

0 comments on commit eeaca0b

Please sign in to comment.