WS-Telegraph
This is a simple set of scripts that implement RPC over WebSocket. As communication layer used engine.io library.
User Guide
The package provides two classes: WsTgServer and WsTgClient.
WsTgServer based on Engine.IO and processes requests. WsTgClient provides a way
to invoke methods on the server through websocket and obtains the result of the call.
Old js-style
const WsTgClient = WsTgClient;const WsTgServer = WsTgServer; extend WsTgServer { return { return ; }; } extent WsTgClient { return this; // Promise with result "Hello, Bob" }
With Babel
; extend WsTgServer async { return `Hello, `; } extent WsTgClient async { return await this; }
TODO
- Error handling
Tests
npm run test
. The default port of the server is 3000, if not set another by process.env.PORT
.