Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 529 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 529 Bytes

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