JwRPC
lightweight bidirectional JSON RPC over Websocket
WIP don't use it yet
Features
- Easy To use
- Lightweight, no dependency just a single file
- Bidirectional, both server and clients can send Request and Notification to eachother
- Async and promise based
- Basic rate limiting control
Table of contents
Installing
npm install jwrpc
Usage examples
Simple Server
const WebSocket = ;const JwRPC = ; const wss = port: 3434 ; const serverMethods = 'greet' : RPC_greet 'echo' : RPC_echo 'divide' : RPC_divide ; { console; //for notification calling 'callback' is optional}{ console; //send the 'params' back to client ;}{ console; ifparams1 === 0 return ; ;} wss;
Simple Client
const WebSocket = ;const JwRPC = ; const ws = 'ws://localhost:3434'; ws;