Skip to content

Scukerman/jsonrpc2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsonrpc2

JSON-RPC 2.0 Server & Client for Browser with Transport interfaces.

$ npm install
$ ./node_modules/typings/dist/bin.js install dt~jquery --global
$ ./node_modules/typescript/bin/tsc
$ gulp

Example of usage:

var transport = new JSONRPC2.Transport.Websocket({
	url: "ws://localhost:3000/ws"
});

var client = new JSONRPC2.Client(transport);

var req = new JSONRPC2.Model.Request("Test.Test1", {A: 10, B: 30});
req.send(client).then(function(res) {
	console.log("res:", res);
}, function(err) {
	console.log("err:", err);
});
var transport = new JSONRPC2.Transport.Websocket({
	url: "ws://localhost:3000/ws"
});

var s = new JSONRPC2.Server(transport).useDebug(true);
s.register('Test', {
	'Me': function(params) {
		return "hello, world!"
	},
	'Test1': function(params) {
		return params.A + params.B;
	}
});

About

JSON-RPC 2.0 Server & Client for Browser with Transport interface.

Resources

License

Stars

Watchers

Forks

Packages

No packages published