mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-15 17:35:45 +00:00
18 lines
560 B
Nim
18 lines
560 B
Nim
import news, asyncdispatch, asynchttpserver, net
|
|
|
|
# works with simple echo server from https://github.com/dpallot/simple-websocket-server
|
|
# protSSLv23 is compatible with SimpleExampleServer.py --ver 2
|
|
# protTLSv1 is compatible with SimpleExampleServer.py --ver 3
|
|
|
|
# this test needs to be compiled with -d:ssl
|
|
|
|
proc sendMsg() {.async.} =
|
|
var ws = await newWebSocket("wss://localhost/")
|
|
await ws.send("hi")
|
|
while ws.readyState == Open:
|
|
let packet = await ws.receivePacket()
|
|
echo "received ", packet
|
|
|
|
asyncCheck sendMsg()
|
|
runForever()
|