Giter VIP home page Giter VIP logo

hprose-js's Introduction

Hprose

Promises/A+ logo

Hprose for JavaScript

Join the chat at https://gitter.im/hprose/hprose-js Build Status Sauce Test Status bower version npm version License



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>
<head>
<script type="text/javascript" src="hprose.js" flashpath="/"></script>
</head>
<body>
<script type="text/javascript">
    var client = hprose.Client.create("http://www.hprose.com/example/", ["hello"]);
    client.hello("World!")
    .then(function(result) {
        alert(result);
    }, function(err) {
        alert(err);
    });
</script>
</body>

hprose-js's People

Contributors

andot avatar dsonet avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hprose-js's Issues

刚学这个 请问一下

这个如何使用 get方法?
使用websocket的时候,fd是怎么写的 这个有没有手册什么的

hprose js 和 hprose html5 的区别是?

hprose node 是很好理解的 hprose js 和 html5 则很难区分了,能不能有个页面整体介绍下。最好是个表格,区分出特性,会特别清晰。

这个要求可能很过分,不过真的很想了解清楚,谢谢,麻烦了!

请问后续提供js作为被调用方(即服务端)的支持么?

从文档来看,js支持目前都是调用作为调用方的,请问后续有没有作为服务端的支持呢?
作为服务端的支持的使用场景:

  1. 可以远程调用浏览器上特定函数,省去繁杂的js代码逆向过程。
  2. 其他场景

技术架构:js在chrome浏览器中执行时,通过反向连接到服务集散中心(类似于mqtt)发布消息提供服务,调用方可以通过这服务集散中心去调用真正的服务。

Make hprose aware of CommonJS

I am planning on writing an RPC layer that is capable of running on "almost" all frameworks. In order to properly support this, hprose-js needs to learn to export. This is simple. As you know NodeJS, this will look very familiar to you:

module.exports = hprose;

The idea is, to have hprose initialize on a local variable first (hprose in my case). Then we can do something like jQuery does here: https://github.com/jquery/jquery/blob/2.1.4/dist/jquery.js#L15-L38

Do you think this is possible?

Kind regards,
Ingwie

setHeader跨域

客户端使用了setHeader('Access-Token','sfasdfad');
服务端也设置了$server->crossDomain=true;
调用的时候还是提示跨域问题:

Request header field Access-Token is not allowed by Access-Control-Allow-Headers in preflight response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.