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

RawSocketWebSocketClient (key must be 16 bytes (enforced by ws.js)) #1146

Closed
lemkoleg opened this issue Dec 7, 2022 · 1 comment · Fixed by #1152
Closed

RawSocketWebSocketClient (key must be 16 bytes (enforced by ws.js)) #1146

lemkoleg opened this issue Dec 7, 2022 · 1 comment · Fixed by #1152

Comments

@lemkoleg
Copy link

lemkoleg commented Dec 7, 2022

Call fun suspend fun RawSocketWebSocketClient(
url: String,
protocols: List? = null,
origin: String? = null,
wskey: String? = DEFAULT_WSKEY,
debug: Boolean = false,
connect: Boolean = true,
headers: Http.Headers = Http.Headers(),
masked: Boolean = true,
init: WebSocketClient.() -> Unit = {},
): WebSocketClient {
if (OS.isJsBrowserOrWorker) error("RawSocketWebSocketClient is not supported on JS browser. Use WebSocketClient instead")
val uri = URL(url)
val secure: Boolean = uri.isSecureScheme
return RawSocketWebSocketClient(coroutineContext, AsyncClient.create(secure = secure), uri, protocols, debug, origin, wskey ?: "mykey", headers, masked).also {
init(it)
if (connect) it.internalConnect()
}
}
Throws an exception: key must be 16 bytes (enforced by ws.js)
Correct for const val DEFAULT_WSKEY = "mywskey12345adfg"

@lemkoleg
Copy link
Author

lemkoleg commented Dec 7, 2022

Sorry, I forgot to specify the version. 3.4.0

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