-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add handler for case with unexpected server disconnect
- Loading branch information
1 parent
f6469be
commit e69cd05
Showing
5 changed files
with
90 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
scarlet-protocol-stomp/src/main/java/com/tinder/scarlet/stomp/okhttp/client/WebSocketCode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.tinder.scarlet.stomp.okhttp.client | ||
|
||
enum class WebSocketCode(val code: Int, val reason: String? = null) { | ||
|
||
CLOSE_NORMAL(1000, "Normal closure"), | ||
CLOSE_GOING_AWAY(1001, "Unexpected closure from the Server"), | ||
CLOSED_NO_STATUS(1005, "Expected close status, received none"), ; | ||
|
||
companion object { | ||
|
||
/** | ||
* @return true is this unexpected situation error code | ||
*/ | ||
fun isUnexpectedClose(code: Int): Boolean { | ||
return code == CLOSE_GOING_AWAY.code || code == CLOSED_NO_STATUS.code | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters