mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-15 17:35:45 +00:00
18 lines
481 B
Nim
18 lines
481 B
Nim
import news, asyncdispatch, asynchttpserver
|
|
|
|
var continueTest = true
|
|
|
|
proc establishConnectionAndListen() {.async.} =
|
|
var ws = await newWebSocket("ws://echo.websocket.org:80")
|
|
await ws.sendPing()
|
|
let pong = await ws.receivePacket()
|
|
assert(pong.kind == Pong)
|
|
echo "Got pong"
|
|
continueTest = false
|
|
|
|
asyncCheck sleepAsync(100000) # just to keep dispatcher's queue non-empty
|
|
asyncCheck establishConnectionAndListen()
|
|
while continueTest:
|
|
poll()
|
|
echo "Finished"
|