Hi,
I'm trying to connect to a websockets but somehow it doesn't work(no errors, no response). Did I misunderstand something in the docs?
What I'm trying to do is to use my backend as a bridge between my app and a third party api & websockets.
Note: I'm just starting to learn Vapor.
app.webSocket("echo") { request, ws async in
do {
try await WebSocket.connect(to: "wss://ws.coincap.io/prices?assets=bitcoin", on: app.eventLoopGroup.next()) { innerWS in
// connection successful, innerWS.isClosed returns FALSE here
innerWS.onText { _, string async in
// this whole block is not being called
}
innerWS.onBinary { _, byte async in
// this whole block is not being called
}
}
} catch {
// no errors here
}
}
!