Araq / ormin

Ormin -- An ORM for Nim.
MIT License
153 stars 18 forks source link

A server must not mask any frames that it sends to the client #20

Closed kidandcat closed 4 years ago

kidandcat commented 5 years ago

I get this error in browser: WebSocket connection to 'ws://localhost:8080/' failed: A server must not mask any frames that it sends to the client.

In server:

[Hint] Client connected from 127.0.0.1
processMessage {"cmd":0,"arg":null}
got ping
[Error] Error occurred handling client messages.
socket closed
Async traceback:
  C:\Users\jairo\Desktop\chat-server\ping.nim(21)                        ping
  C:\Users\jairo\.nimble\pkgs\ormin-0.1.0\ormin\serverws.nim(138)        serve
  C:\Users\jairo\Nim\lib\pure\asyncdispatch.nim(1879)                    waitFor
  C:\Users\jairo\Nim\lib\pure\asyncdispatch.nim(1569)                    poll
  C:\Users\jairo\Nim\lib\pure\asyncdispatch.nim(379)                     runOnce
  C:\Users\jairo\Nim\lib\pure\asyncdispatch.nim(210)                     processPendingCallbacks
  C:\Users\jairo\Nim\lib\pure\asyncmacro.nim(34)                         recvFrameNimAsyncContinue
  C:\Users\jairo\Desktop\chat-server\websocket\websocket\shared.nim(164) recvFrameIter
  C:\Users\jairo\Desktop\chat-server\websocket\websocket\shared.nim(150) raiseReadException
Exception message: socket closed
Exception type:

The code:

import ormin / [serverws]
import ormin

import json

importModel(DbBackend.sqlite, "chat_model")

#var db {.global.} = open("chat_ormin.db", "", "", "")

protocol "pingclient.nim":
  server "ping":
    echo "got ping"
    send(%1)

  client "ping":
    proc ping*() {.exportc.}
    var res: int
    res = recv(int)
    echo "got " & $res

serve "ormin", dispatch