https://github.com/hprose/hprose-js
Hprose is a cross-language RPC. This project is Hprose 2.0 RPC for JavaScript
https://github.com/hprose/hprose-js
cross-browser cross-desktop cross-device cross-domain cross-language cross-platform hprose javascript rpc rpc-client rpc-framework serialization serialization-library serialize serializer tcp websockets
Last synced: 2 months ago
JSON representation
Hprose is a cross-language RPC. This project is Hprose 2.0 RPC for JavaScript
- Host: GitHub
- URL: https://github.com/hprose/hprose-js
- Owner: hprose
- License: mit
- Created: 2014-02-15T11:39:58.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-02-02T01:38:43.000Z (over 7 years ago)
- Last Synced: 2025-03-03T23:49:56.981Z (3 months ago)
- Topics: cross-browser, cross-desktop, cross-device, cross-domain, cross-language, cross-platform, hprose, javascript, rpc, rpc-client, rpc-framework, serialization, serialization-library, serialize, serializer, tcp, websockets
- Language: JavaScript
- Homepage:
- Size: 2.03 MB
- Stars: 134
- Watchers: 24
- Forks: 44
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Hprose for JavaScript
[](https://gitter.im/hprose/hprose-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://travis-ci.org/hprose/hprose-js)
[](https://saucelabs.com/u/hprose-js)
[](http://bower.io/search/?q=hprose)
[](https://www.npmjs.com/package/hprose-js)
[](http://opensource.org/licenses/MIT)>---
- **[Introduction](#introduction)**
- **[Browser support](#browser-support)**
- **[Hybird app support](#hybird-app-support)**
- **[Usage](#usage)**
- **[Exception Handling](#exception-handling)**>---
## Introduction
*Hprose* is a High Performance Remote Object Service Engine.
It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware. It is not only easy to use, but powerful. You just need a little time to learn, then you can use it to easily construct cross language cross platform distributed application system.
*Hprose* supports many programming languages, for example:
* AAuto Quicker
* ActionScript
* ASP
* C++
* Dart
* Delphi/Free Pascal
* dotNET(C#, Visual Basic...)
* Golang
* Java
* JavaScript
* Node.js
* Objective-C
* Perl
* PHP
* Python
* Ruby
* ...Through *Hprose*, You can conveniently and efficiently intercommunicate between those programming languages.
This project is the implementation of Hprose for JavaScript.
Hprose 2.0 for JavaScript Documents(中文版): https://github.com/hprose/hprose-js/wiki
### Browser support
#### Desktop browsers
* Google Chrome
* Apple Safari
* Mozilla Firefox
* Opera
* Microsoft Internet Explorer 6.0+
* Netscape 7+
* Konqueror
* ...#### Mobile browsers
* Apple Safari on iOS
* Google Chrome on iOS
* Google Chrome on Android
* Default Browser on Android
* Internet Explorer on Windows Phone
* Opera Mobile
* Default Browser on WebOS
* Default Browser on Blackberry
* Default Browser on N9 MeeGo
* Mozilla Firefox on N9 MeeGo
* \*Default Browser on Symbian
* \*Opera Mini
* \*Pocket IE
* ...All of the above browsers (except asterisk marked) support cross-domain invoking with Hprose for JavaScript.
### Hybird app support
* ionic + cordova (http, tcp, websocket)
* Chrome extentions (http, tcp, websocket)
* APICloud (http, tcp*)
* DCloud (http)
* AppCan (http)
* DeviceOne (http)
* ... (http, websocket)TCP is only available on iOS for APICloud, because there is a bug of APICloud Android SDK, and they don't want to fix this bug.
## Usage
You don't need use the javascript source files. You only need include `hprose.js` in your html.
The file `FlashHttpRequest.swf` you can put it on anywhere, and then specify its load path by setting the `flashpath` attribute in the `script` tag. If you omit this attribute, the default path is current path.
### Exception Handling
If an error occurred on the server, or your service function/method throw an exception, it will be sent to the client. You need to pass an error callback function after succuss callback function to receive it. If you omit this callback function, the client will ignore the exception, like never happened.
For example:
```html
var client = hprose.Client.create("http://www.hprose.com/example/", ["hello"]);
client.hello("World!")
.then(function(result) {
alert(result);
}, function(err) {
alert(err);
});```