{"id":15354918,"url":"https://github.com/capaj/socket.io-rpc-client","last_synced_at":"2025-04-15T06:20:42.945Z","repository":{"id":25989601,"uuid":"29431860","full_name":"capaj/socket.io-rpc-client","owner":"capaj","description":"client library for a socket.io-rpc ","archived":false,"fork":false,"pushed_at":"2016-02-16T11:08:23.000Z","size":50,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T17:01:46.746Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capaj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-18T16:17:01.000Z","updated_at":"2021-10-23T05:09:51.000Z","dependencies_parsed_at":"2022-09-12T03:10:54.185Z","dependency_job_id":null,"html_url":"https://github.com/capaj/socket.io-rpc-client","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fsocket.io-rpc-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fsocket.io-rpc-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fsocket.io-rpc-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fsocket.io-rpc-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capaj","download_url":"https://codeload.github.com/capaj/socket.io-rpc-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788869,"owners_count":21161726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T12:21:39.453Z","updated_at":"2025-04-15T06:20:42.929Z","avatar_url":"https://github.com/capaj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# socket.io-rpc-client [![Build Status](https://travis-ci.org/capaj/socket.io-rpc-client.svg?tag=1.0.3)](https://travis-ci.org/capaj/socket.io-rpc-client) [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\nclient library for a [socket.io-rpc](https://github.com/capaj/socket.io-rpc)\n\nAll libraries are written in commonJS module style, so you need to use SystemJS loader to be able to use them in the browser. Browserify/webpack might work, if you set it up correctly, but might be a pain and you're probably will have to delve deep into the code.\nAngular.js lib contains special rpc-controller directive, which when compiled asynchronously loads server channel and instantiates classic angular controller when this channel is ready.\n#Usage\n```npm install socket.io-rpc-client```  for serverside usage\n\n```jspm install socket.io-rpc-client``` for clientside usage\n\nthen in Node.js:\n```javascript\nvar rpcClient = require('socket.io-rpc-client');\n\nvar rpc = rpcClient('http://localhost:8032');\n//call to the server\nrpc('plain')().then(function(ret) {\n\tconsole.log('plain returned ', ret);\t//for test-utils/sample-server.js server prints out: plain returned 41\n});\n//expose some for the server to call\nrpc.expose({\n\tfnOnClient: function() {\n\t\tconsole.log('called client method');\n\t\treturn 42;\n\t},\n\tasyncOnClient: function() {\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\tsetTimeout(function(){\n\t\t\t\tresolve('resolved after 40ms');\n\t\t\t}, 40);\n\t\t});\n\t},\n\terroringMethod: function() {\n\t\tnotdefined.error.will.propagate;\n\t}\n});\n\n```\n\nin the browser:\n```javascript\nvar myChannel = require('rpc/test');   //CJS style require\n//or\nimport {default as myChannel} from 'rpc/myChannel'; //ES6 style require\n\nmyChannel.getTime().then(t =\u003e { //calls getTime function on the server\n    console.log(\"t\", t);    //t is the serverside return value or serverside promise resolve value\n});    \n```\n\nFor complete examples including server side refer to [socket.io-rpc project](https://github.com/capaj/socket.io-rpc)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fsocket.io-rpc-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapaj%2Fsocket.io-rpc-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fsocket.io-rpc-client/lists"}