Skip to content

Commit

Permalink
Merge pull request #96 from salemove/fix/websocket_onclosing
Browse files Browse the repository at this point in the history
Fix WebSocket not closed in onClosing
  • Loading branch information
dsrees authored Aug 2, 2023
2 parents 5248447 + 28f0086 commit 1118da2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/kotlin/org/phoenixframework/Transport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class WebSocketTransport(

override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
this.readyState = Transport.ReadyState.CLOSING
webSocket.close(code, reason)
}

override fun onMessage(webSocket: WebSocket, text: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class WebSocketTransportTest {
transport.readyState = Transport.ReadyState.OPEN

transport.onClosing(mockWebSocket, 10, "reason")
verify(mockWebSocket).close(10, "reason")
assertThat(transport.readyState).isEqualTo(Transport.ReadyState.CLOSING)
}

Expand Down

0 comments on commit 1118da2

Please sign in to comment.