-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Okhttp Websocket client 'closeReason' is not completed when websocket fails #1363
Comments
It should complete exceptionally, |
Then you should update doc as well:
|
Hi @varahash, @cy6erGn0m, the only issue I found is that OkHttp actually does not complete close reason in case of failure. I fixed it in the PR above. |
Why documentation says that ktor/ktor-http/ktor-http-cio/common/src/io/ktor/http/cio/websocket/DefaultWebSocketSession.kt Lines 23 to 27 in 08fcd12
How CIO implementation completes |
@varahash, the documentation says so because in some corner cases |
If so, maybe it is better to make OkHttp version match CIO implementation. |
Well, if we are talking from a design perspective I think it would be more informative to pass exception in CIO. |
I merged the corresponding PR, so the fix is in master now. Feel free to reopen the issue if you have additional comments. |
Ktor Version and Engine Used (client or server and name)
io.ktor:ktor-client-okhttp:1.2.4
Describe the bug
The 'closeReason' at line https://github.com/ktorio/ktor/blob/1.2.4/ktor-client/ktor-client-okhttp/jvm/src/io/ktor/client/engine/okhttp/OkHttpWebsocketSession.kt#L48
must be completed with 'null' value when websocket fails here: https://github.com/ktorio/ktor/blob/1.2.4/ktor-client/ktor-client-okhttp/jvm/src/io/ktor/client/engine/okhttp/OkHttpWebsocketSession.kt#L93
The text was updated successfully, but these errors were encountered: