Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaredly/reason-websocket
A websocket library for reason native
https://github.com/jaredly/reason-websocket
Last synced: 23 days ago
JSON representation
A websocket library for reason native
- Host: GitHub
- URL: https://github.com/jaredly/reason-websocket
- Owner: jaredly
- Created: 2018-07-01T00:12:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-06T04:48:53.000Z (over 6 years ago)
- Last Synced: 2024-10-10T12:08:31.178Z (about 1 month ago)
- Language: OCaml
- Size: 305 KB
- Stars: 57
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Reason Websocket
A fork of Based on https://github.com/vbmithr/ocaml-websocketA library for native websocket server development.
Here's what it looks like to run a websocket server:
```re
Server.run(
~port=9876,
~onMessage=(text, reply) => {
reply("Thanks for the " ++ text)
},
~httpFallback=(method, path, headers, msg, respond) => {
respond(
"HTTP/1.1 200 OK\r\nContent-Length: 5\r\nContent-Type: text/plain\r\n\r\nHello",
)
},
~config=(module Server.UnixConfig: Server.Config)
)
``````
# in this directory
npm install
npm run build
./lib/bs/native/serverexample.native
```Then open `http://localhost:9876`
![screenshot](screenshot.png)