Skip to content
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

websocket 无法在onopen 取 isReconnect #615

Open
baidwwy opened this issue Aug 29, 2024 · 1 comment
Open

websocket 无法在onopen 取 isReconnect #615

baidwwy opened this issue Aug 29, 2024 · 1 comment

Comments

@baidwwy
Copy link

baidwwy commented Aug 29, 2024

查看源码,发现在onConnection之后就进行了reset
而ws是在onMessage才触发onopen

libhv/evpp/TcpClient.h

Lines 134 to 145 in b7928e9

channel->onconnect = [this]() {
if (unpack_setting) {
channel->setUnpack(unpack_setting);
}
channel->startRead();
if (onConnection) {
onConnection(channel);
}
if (reconn_setting) {
reconn_setting_reset(reconn_setting);
}
};

@ithewei
Copy link
Owner

ithewei commented Aug 30, 2024

是的,这么看来,WebSocketClient里没法使用isReconnect获取是否是重连上的,只能外部自己在onopen、onclose回调里自己记录下了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants