troyzhxu / okhttps

如艺术一般优雅,像 1、2、3 一样简单,前后端通用,轻量却强大的 HTTP 客户端(同时支持 WebSocket 与 Stomp 协议)
https://ok.zhxu.cn
Apache License 2.0
487 stars 75 forks source link

"You must call connect before send" error #59

Closed Bikeskin closed 2 years ago

Bikeskin commented 2 years ago

Hi,

when user open screen, send connect request and click back button quickly and call disconnect(true) library throw "You must call connect before send". I think we have to add control here; https://github.com/ejlchina/okhttps/blob/f6e3e50ac38f1c53502b78a942269a97047d2a6f/okhttps-stomp/src/main/java/com/ejlchina/stomp/Stomp.java#L115

Or do you have any suggestion? In my code, connect in onResume, disconnect in onPause.

Thanks for this library 😎

troyzhxu commented 2 years ago

Thanks for reporting this bug. It will be fixed in next version. And now you can try disconnect() or disconnect(int maxWaitSeconds) instead.

troyzhxu commented 2 years ago

fixed in v3.4.5 : https://github.com/ejlchina/okhttps/releases/tag/v3.4.5