mirror of
https://github.com/tursom/TursomServer.git
synced 2025-01-01 07:50:47 +08:00
update WebSocketClient.kt
This commit is contained in:
parent
aeda793a5d
commit
0cc94bf998
@ -1,5 +1,6 @@
|
|||||||
package cn.tursom.core.ws
|
package cn.tursom.core.ws
|
||||||
|
|
||||||
|
import cn.tursom.core.ShutdownHook
|
||||||
import cn.tursom.core.buffer.ByteBuffer
|
import cn.tursom.core.buffer.ByteBuffer
|
||||||
import cn.tursom.core.buffer.impl.NettyByteBuffer
|
import cn.tursom.core.buffer.impl.NettyByteBuffer
|
||||||
import io.netty.bootstrap.Bootstrap
|
import io.netty.bootstrap.Bootstrap
|
||||||
@ -37,6 +38,12 @@ open class WebSocketClient(
|
|||||||
var ch: Channel? = null
|
var ch: Channel? = null
|
||||||
internal set
|
internal set
|
||||||
|
|
||||||
|
init {
|
||||||
|
ShutdownHook.addHook {
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun open() {
|
fun open() {
|
||||||
close()
|
close()
|
||||||
val scheme = if (uri.scheme == null) "ws" else uri.scheme
|
val scheme = if (uri.scheme == null) "ws" else uri.scheme
|
||||||
|
Loading…
Reference in New Issue
Block a user