Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcubic/json-rpc
JSON-RPC implementaion in php and JavaScript
https://github.com/jcubic/json-rpc
javascript json json-rpc php
Last synced: 3 months ago
JSON representation
JSON-RPC implementaion in php and JavaScript
- Host: GitHub
- URL: https://github.com/jcubic/json-rpc
- Owner: jcubic
- License: mit
- Created: 2012-01-12T12:54:26.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2021-11-24T08:42:40.000Z (about 3 years ago)
- Last Synced: 2024-05-01T18:58:03.191Z (8 months ago)
- Topics: javascript, json, json-rpc, php
- Language: PHP
- Homepage:
- Size: 39.1 KB
- Stars: 13
- Watchers: 5
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## [Server and Client implementaion of JSON-RPC (php <=> javascript)](https://github.com/jcubic/json-rpc/)
This is JSON-RPC implementaion, server in php and client in javascript
based on [version 1.1 of the Specification][1]## Server
```php
```
## Client
```javascript
rpc({
url: "foo.php",
error: function(error) {
alert(error.message);
},
// errorOnAbort: true,
debug: function(json, which) {
console.log(which + ': ' + JSON.stringify(json));
}
})(function(foo) {
// now here you can access methods from Foo class
foo.ping("Hello")(function(response) {
alert(response);
});
});
```if you prefer to use promises, you can use option `promisify: true`:
```javascript
rpc({
url: 'servce.php'.
promisify: true
}).then(function(service) {
service.ping("hello").then(function(response) {
alert(resonse);
});
});
```## Requirement
* mbstring php module
## License
Released under the [MIT license][2]
Copyright (c) 2011-2021 [Jakub T. Jankiewicz][3][1]: http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html "JSON-RPC 1.1 Specification"
[2]: https://opensource.org/licenses/MIT "The MIT License (MIT)"
[3]: https://jcubic.pl/me "Jakub T. Jankiewicz"