npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hessian-proxy-garbled

v0.1.0

Published

hessian proxy to make rpc calls for javascript

Downloads

13

Readme

Node Hessian Proxy

fix chinese grabled bugs!

RPC Proxy support hessian 2.0 protocol, with fully tested via test service in http://hessian.caucho.com/test/test2

I couldn't not find a stable hessian 1.0 protocol test service. so 1.0 is not fully implmented yet.

Build Status

Installation

npm install hessian-proxy-garbled

Usage

var Proxy = require('hessian-proxy').Proxy;

var proxy = new Proxy('http://example.com/test', username, password, proxy);

proxy.invoke(methodName, [arg1, arg2, arg3..], function(err, reply) {
    // ... do with reply
});

// use writer2
var Writer = require('hessian-proxy').Writer2; // for hessian2.0

var writer = new Writer();
writer.writeCall(method, [arg1, arg2…]);

var buffer = writer.getBuffer();

// use reader2
var Reader = require('hessian-proxy').Reader2; // for hessian2.0

var reader = new Reader();
var data = reader.readRPCMessage(buffer).getData();


Support Value Types

Binary

Binary will be represented by Buffer in node js.

Boolean

true or false

Date

Represented as Date type.

Double

In javascript, all double are numbers and represented via 64-bit double. so it will not be able to write a 32-bit float format, but it can read 32-bit float as double.

Int

Just as normal int.

List

Arrays will be sent as list, typed list need to add a property 'type' to the array. Typed List will have type in 'type' property.

// untyped list
var list = [1,2,3];

// typed list
var list = ['a', 'b', 'c'];
list.__type__ = '[string';

Long

use Long.js to handle long value.

var Long = require('long');

var long = new Long(low, high);

// or 
var long = { low: lowbit, high: highbit };

Map

If you don't care about key type, all the keys will be string. the normal Object will be treated as a map. If you want to parse/send maps that use objects as key. You have to expose a ES6 standard Map Class to global namespace.

And typed Map will have type in 'mapType' property.

For example:

global.Map = require('es6-map-shim').Map;
// normal untyped map, all the key will be string
var map = {  
	1: 1,
	'a': 0, 
	'b': 2
};

// normal typed map
var map = {  
    'a': 0, 
    'b': 1
};

map.__mapType__ = 'java.util.Hashtable';

// es6 Map, object can be used as key
var map = new Map();
map.set(['a'], 0);
map.set('b', 1);
map.set(true, 'true');

// add type
map.__mapType__ = 'java.util.Hashtable';

Ref

The proxy will take the job for you if the objects are equal via strict equal '===='.

Object

To send Object, objects must have a type in 'type' property. Otherwise, it will be send as a map.

var obj = {
    'value': 0,
    'next': 1
};

obj.__type__ = 'com.test.TestObject';

Null

Just as null.

Web Service

For webservice support call, reply, fault. packet+ and envelope+ current are not supported yet.

See test/test2.js to get more examples how to use specific type.

Reference

Hessian 2.0 Serialization

Hessian 2.0 Web Service Protocol

Hessian Test

Hessian 1.0 Spec

Notice: There are some mistakes in the document and make a lot of confuse when writing protocol according to spec, especially when doing test and just find test docs are not correct for some arguments values.

License

(The BSD License)

Copyright (c) 2013, Villa.Gao <[email protected]>;
All rights reserved.