Android client, in version 5.0.0-preview.8.20414.8, call HubConnection.onClosed(this) problem.
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
1.The client network is abnormally disconnected
2.The server network is abnormally disconnected
3.The server closes and disconnects
4.The client normally stops and disconnects
`override fun invoke(exception: Exception?) {`
`LogUtils.sf("invoke ${exception?.message.toString()}")`
`mSignalImp.disconnected()`
`}`
I tested the four cases, only the second one will take a long time to get the callback, probably more than one minute, and the other three methods will get the callback immediately.
I found RealWebSocket.class in the source code of Okhttp3, which has an attribute
`/**`
`* The maximum amount of time after the client calls [close] to wait for a graceful shutdown. If`
`* the server doesn't respond the web socket will be canceled.`
`*/`
`private const val CANCEL_AFTER_CLOSE_MILLIS = 60L * 1000`
In the case of server network abnormality, how can the client get the disconnection callback in a short time instead of printing the log `HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..` It takes one minute to print to get the onClose callback.
I now want to get the callback in the invoke method of onClose immediately after disconnecting no matter what the situation, what do I need to do, please help me.
Contributor guide
Assessment
This issue has not been assessed yet.