mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
THRIFT-4131: js / WebSocket / fix handling oneway methods
Client: js Patch: Martin Hejnfelt <mh@newtec.dk> This closes #1372
This commit is contained in:
parent
a17ef79e8f
commit
48ba736a58
@ -1510,6 +1510,9 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
||||
f_service_ << indent() << "return this.output.getTransport().flush(callback);" << endl;
|
||||
} else {
|
||||
f_service_ << indent() << "if (callback) {" << endl;
|
||||
if((*f_iter)->is_oneway()) {
|
||||
f_service_ << indent() << " this.output.getTransport().flush(true, null);" << endl;
|
||||
} else {
|
||||
f_service_ << indent() << " var self = this;" << endl;
|
||||
f_service_ << indent() << " this.output.getTransport().flush(true, function() {" << endl;
|
||||
f_service_ << indent() << " var result = null;" << endl;
|
||||
@ -1520,6 +1523,7 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
||||
f_service_ << indent() << " }" << endl;
|
||||
f_service_ << indent() << " callback(result);" << endl;
|
||||
f_service_ << indent() << " });" << endl;
|
||||
}
|
||||
f_service_ << indent() << "} else {" << endl;
|
||||
f_service_ << indent() << " return this.output.getTransport().flush();" << endl;
|
||||
f_service_ << indent() << "}" << endl;
|
||||
|
@ -575,6 +575,15 @@ Thrift.TWebSocketTransport.prototype = {
|
||||
clientCallback();
|
||||
};
|
||||
}()));
|
||||
if(callback) {
|
||||
this.callbacks.push((function() {
|
||||
var clientCallback = callback;
|
||||
return function(msg) {
|
||||
self.setRecvBuffer(msg);
|
||||
clientCallback();
|
||||
};
|
||||
}()));
|
||||
}
|
||||
} else {
|
||||
//Queue the send to go out __onOpen
|
||||
this.send_pending.push({
|
||||
|
Loading…
Reference in New Issue
Block a user