Hello everyone, I am trying to implement websocket...
# server
k
Hello everyone, I am trying to implement websocket feature with ktor, but I only get 404 for the http://localhost:8080/ request in browser. Could you, please, tell me what can be wrong? Here is my websocket implementation:
Copy code
webSocket("/") {
    while (true) {
        delay(3000)
        outgoing.send(Frame.Text("hi"))
    }
}
f
did you "installed" WebSockets?
Copy code
install(WebSockets)
k
@Foso of course 🙂
f
okay, try to connect to ws://localhost:8080/
k
@Foso I had relaunch server and tried to connect but..
Copy code
install(WebSockets){
    pingPeriod = Duration.ofSeconds(60)
    timeout = Duration.ofSeconds(15)
    maxFrameSize = Long.MAX_VALUE
    masking = false
}
install setup
f
i meant in your websocket client where you connect to your websocket
k
my client is a web browser, i also tried with chrome extension but result the same
f
okay, then i don't know a quick solution, try to check in the debugger if there is an incoming connection for your websocket. Maybe you should also post your question in #ktor
a
should i be concerned? 🤔
f
I don't know why it needs that permission, but you can also get it from here: https://github.com/hakobera/Simple-WebSocket-Client
j
when you need to access to the tabs, unfortunaly chrome ask this permissions 😞
I don't know why and i have the same problem in my chrome extention