Skip to content

zhiqiangxu/node_qrpc_ws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

var qrpc = require("qrpc-over-ws");


var conf = new qrpc.Config()
conf.setDialTimeout(1000);

var addr="ws://localhost:8901/qrpc";
var conn = new qrpc.Connection(addr, conf, function(conn, frame){
	console.log("pushed", frame);
}, function(conn) {
	console.log("closed");
});


var cmd = 0;
var flags = 0;
var loginRequest = {"app":"app","uid":"cs1","device":"mac","token":"cs"};
var payload = JSON.stringify(loginRequest);
conn.connect().then(function(ev) {
	return conn.request(cmd, flags, payload);
}).then(function(frame){
	console.log("login data", new TextDecoder('utf-8').decode(frame.payload));
}).catch(function(error){
	console.log("error", error);
});

About

qrpc over websocket for js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published