{"library":"socket-rpc","title":"socket-rpc","type":"library","description":"A simple RPC framework for Node.js using socket.io that follows a server-slave model. Version 1.0.3 is the latest stable release. It allows the server to call functions registered on slave clients via WebSocket. Key differentiators: lightweight, minimal API, built on socket.io. Note: The library is somewhat outdated and relies on socket.io v1.x, which may have compatibility issues with newer versions.","language":"javascript","status":"maintenance","last_verified":"Fri May 01","install":{"commands":["npm install socket-rpc"],"cli":null},"imports":["import { RPCServer } from 'socket-rpc'","import { RPCSlave } from 'socket-rpc'","import { RPCServer } from 'socket-rpc'"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/polariszz/socket-rpc","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/socket-rpc","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import http from 'http';\nimport { RPCServer } from 'socket-rpc';\nimport { RPCSlave } from 'socket-rpc';\n\n// Server\nconst server = http.createServer();\nconst rpc = RPCServer(server);\nrpc.getServer(); // returns socket.io server instance\n\n// Slave (client)\nconst slave = RPCSlave({\n  url: 'http://localhost:8000',\n  id: 0,\n  name: 'example'\n});\nslave.register('greet', name => `Hello, ${name}`);\n\n// Then server can call:\nrpc.run('0', 'greet', 'World').then(msg => console.log(msg));\n\nserver.listen(8000);","lang":"javascript","description":"Demonstrates creating a server and slave, registering a function on slave, and calling it from the server.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}