niv / websocket.nim

websockets for nim
http://niv.github.io/websocket.nim/docs/0.1.1/websocket.html
Other
102 stars 25 forks source link

the sample client doesn't compile #62

Closed geohuz closed 4 years ago

geohuz commented 5 years ago
import websocket, asyncnet, asyncdispatch

let ws = waitFor newAsyncWebsocketClient("localhost", Port(8080),
  path = "/", protocols = @["myfancyprotocol"])
echo "connected!"

proc ping() {.async.} =
  while true:
    await sleepAsync(6000)
    echo "ping"
    await ws.sendPing()

proc read() {.async.} =
  while true:
    let (opcode, data) = await ws.readData()
    echo "(opcode: ", opcode, ", data: ", data, ")"

asyncCheck read()
asyncCheck ping()
runForever()

with the following error:

.nimble/pkgs/websocket-0.4.0/websocket/client.nim(106, 34) Error: type mismatch: got <userAgent: string, sslContext: SslContext>
but expected one of:
proc newAsyncHttpClient(userAgent = defUserAgent; maxRedirects = 5;
                       sslContext = getDefaultSSL(); proxy: Proxy = nil): AsyncHttpClient
  first type mismatch at position: 2
  required type for sslContext: SSLContext
  but expression 'sslContext = sslContext' is of type: SslContext
dom96 commented 5 years ago

try nimble install websocket@#head

geohuz commented 4 years ago

yeah it fixed issue!