File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ import Foundation
1010
1111public func websocket(
1212 _ text: ( ( WebSocketSession , String ) -> Void ) ? ,
13- _ binary: ( ( WebSocketSession , [ UInt8 ] ) -> Void ) ? ) -> ( ( HttpRequest ) -> HttpResponse ) {
13+ _ binary: ( ( WebSocketSession , [ UInt8 ] ) -> Void ) ? ,
14+ _ pong: ( ( WebSocketSession , [ UInt8 ] ) -> Void ) ? ) -> ( ( HttpRequest ) -> HttpResponse ) {
1415 return { r in
1516 guard r. hasTokenForHeader ( " upgrade " , token: " websocket " ) else {
1617 return . badRequest( . text( " Invalid value of 'Upgrade' header: \( r. headers [ " upgrade " ] ?? " unknown " ) " ) )
@@ -90,6 +91,9 @@ public func websocket(
9091 session. writeFrame ( ArraySlice ( frame. payload) , . pong)
9192 }
9293 case . pong:
94+ if let handlePong = pong {
95+ handlePong ( session, frame. payload)
96+ }
9397 break
9498 }
9599 }
You can’t perform that action at this time.
0 commit comments