Skip to content

graforlock/bs-websocket

Repository files navigation

bs-websocket

Installation:

npm i --save bs-websocket

Example:

open WebsocketClient;

let ws = Websocket.make("ws://localhost:3000/", ~protocols=[| "protocolOne" |]);

Websocket.onOpen(ws, _ => {
  Websocket.send(ws, "BOOGEYMAN!");
});

Websocket.onMessage(ws, ev => {
  Js.log({j|Message received: $ev|j}) 
});

Websocket.onError(ws, ev => {
  Js.log(ev);
  Websocket.close(ws);
});

Websocket.onClose(ws, ev => {
  Js.log(ev);
});

API Documentation: wiki

About

Simple websocket browser API bindings.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published