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

feat: support auto reconnect for ReverseWebsocketAdapter #621

Merged
merged 4 commits into from
Dec 12, 2022

Conversation

BlueGlassBlock
Copy link
Contributor

Problem: it seemed that I directly imported exceptions from java.net.

Disclaimer: I don't know kotlin.

Comment on lines 45 to 52
while (client.isActive) {
try {
client.ws(buildWsRequest(destination, setting)) {
webSocketSession = this

handleReverseWs(this@WsClient)
handleReverseWs(this@WsClient)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是没处理掉线期间新消息进入这个 old session 的问题 (suspend fun send(content: String))

在等待重连的时候 send 被执行不会有问题吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我让 ws session 变成 nullable 了,不过可能还是会有 data race...

@BlueGlassBlock
Copy link
Contributor Author

感谢 review,明天我会尝试修复这些东西()

不过直接引入 java.net 真的没问题吗

@Karlatemp
Copy link
Member

没问题啊, mah是jvm only的

@BlueGlassBlock
Copy link
Contributor Author

没问题啊, mah是jvm only的

主要是担心其他 engine 的行为不同(毕竟 ktor)

@ryoii ryoii merged commit 61af6fb into project-mirai:master Dec 12, 2022
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

Successfully merging this pull request may close these issues.

3 participants