Skip to content

jaredly/reason-websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reason Websocket

A fork of Based on https://github.com/vbmithr/ocaml-websocket

A library for native websocket server development.

Here's what it looks like to run a websocket server:

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

About

A websocket library for reason native

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published