https://github.com/stisa/jswebsockets
Websocket wrapper for nim js backend
https://github.com/stisa/jswebsockets
hacktoberfest js-backend nim websockets ws
Last synced: 20 days ago
JSON representation
Websocket wrapper for nim js backend
- Host: GitHub
- URL: https://github.com/stisa/jswebsockets
- Owner: stisa
- License: mit
- Created: 2017-03-01T15:48:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-25T21:10:11.000Z (about 8 years ago)
- Last Synced: 2025-04-09T16:18:53.352Z (20 days ago)
- Topics: hacktoberfest, js-backend, nim, websockets, ws
- Language: Nim
- Homepage:
- Size: 30.3 KB
- Stars: 14
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
JsWebsockets
----Beginning of a wrapper for websockets, for the javascript backend of [nim](https://nim-lang.org)
[Examples](http://stisa.space/jswebsockets)[Generated Docs](http://stisa.space/jswebsockets/jswebsockets.html)
```nim
import jswebsocketsvar
socket = newWebSocket("ws://echo.websocket.org/")socket.onOpen = proc (e:Event) =
echo("sent: test")
socket.send("test")
socket.onMessage = proc (e:MessageEvent) =
echo("received: ",e.data)
socket.close(StatusCode(1000),"received msg")
socket.onClose = proc (e:CloseEvent) =
echo("closing: ",e.reason)
```