niv / websocket.nim

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

Server stops running as the socket closed by remote peer, close code: 1001 #38

Closed gogolxdong closed 6 years ago

gogolxdong commented 6 years ago

Using websocket in karax , client closes with every refreshing, so does the server. I think it's out of the single thread of async socket, will multi-threads help?

metagn commented 6 years ago

What do you mean every refreshing? Do you mean when you refresh the page on which the karax client and JS websocket client is running on? If that's the case I think that's just how browsers behave, you could utilize cookies though I think.

gogolxdong commented 6 years ago

Trick lies in karax I think, vue.js doesn't cause websocket server crash in the same way. Point is server should not crash as the socket is closed by remote peer .

metagn commented 6 years ago

Fair enough, now if the client closes you get Close opcode and data you can turn into a close code and reason by using extractCodeData.