Comparing version 1.6.10 to 1.7.0
@@ -396,4 +396,4 @@ "use strict"; | ||
: config.forceNumber | ||
? "number" | ||
: "number|Long"; | ||
? "number" | ||
: "number|Long"; | ||
break; | ||
@@ -793,3 +793,3 @@ case "bool": | ||
"@constructor", | ||
"@param {wsgrpc.Channel} channel RPC Channel" | ||
"@param {wsgrpc.IChannel} channel RPC Channel" | ||
]); | ||
@@ -796,0 +796,0 @@ push("function " + escapeName(service.name) + "(channel) {"); |
@@ -20,3 +20,3 @@ import { Message, RpcMeta, ValueCallback } from "./types"; | ||
onResponse(callback: ValueCallback<any>): void; | ||
onError(callback: ValueCallback<any>): void; | ||
onError(callback: any): void; | ||
} |
@@ -104,8 +104,9 @@ "use strict"; | ||
throw e_1; | ||
case 6: | ||
console.log("[WSGRPC]:-> " + meta.path, request); | ||
return [4 /*yield*/, this.protocol.request(meta, request)]; | ||
case 6: return [4 /*yield*/, this.protocol.request(meta, request)]; | ||
case 7: | ||
res = _b.sent(); | ||
console.log("[WSGRPC]:<- " + meta.path, meta.responseStream ? "[stream]" : res); | ||
// console.log( | ||
// `[WSGRPC]:<- ${meta.path}`, | ||
// meta.responseStream ? "[stream]" : res | ||
// ); | ||
return [2 /*return*/, res]; | ||
@@ -131,3 +132,3 @@ } | ||
e_2 = _a.sent(); | ||
this._onError && this._onError(e_2); | ||
this._onError && this._onError(e_2, { meta: meta, request: request }); | ||
return [3 /*break*/, 3]; | ||
@@ -134,0 +135,0 @@ case 3: return [2 /*return*/]; |
@@ -88,3 +88,3 @@ "use strict"; | ||
else { | ||
console.warn("stream not found for message:", streamID); | ||
// console.warn("stream not found for message:", streamID); | ||
} | ||
@@ -91,0 +91,0 @@ }; |
@@ -52,1 +52,4 @@ /// <reference types="node" /> | ||
} | ||
export interface IChannel { | ||
rpcCall<T>(meta: RpcMeta, request: Message<T>): any; | ||
} |
export { ServiceFactory, RpcMeta, ServiceMeta } from "./types"; | ||
export { Channel } from "./ChannelNode"; | ||
export { IChannel } from "./interfaces"; | ||
export { HttpChannel } from "./http/Client"; | ||
export { HttpServer } from "./http/Server"; | ||
export { Service } from "./Service"; | ||
@@ -4,0 +7,0 @@ export { createServer } from "./server"; |
@@ -5,4 +5,10 @@ "use strict"; | ||
global.WebSocket = require("ws"); | ||
// @ts-ignore | ||
global.fetch = require("node-fetch"); | ||
var ChannelNode_1 = require("./ChannelNode"); | ||
exports.Channel = ChannelNode_1.Channel; | ||
var Client_1 = require("./http/Client"); | ||
exports.HttpChannel = Client_1.HttpChannel; | ||
var Server_1 = require("./http/Server"); | ||
exports.HttpServer = Server_1.HttpServer; | ||
var Service_1 = require("./Service"); | ||
@@ -9,0 +15,0 @@ exports.Service = Service_1.Service; |
export { Channel } from "./ChannelWeb"; | ||
export { IChannel } from "./interfaces"; | ||
export { HttpChannel } from "./http/Client"; | ||
export { Service } from "./Service"; | ||
@@ -3,0 +5,0 @@ export { ServiceFactory } from "./types"; |
@@ -6,5 +6,9 @@ "use strict"; | ||
global.WebSocket = require("ws"); | ||
// @ts-ignore | ||
global.fetch = require("node-fetch"); | ||
} | ||
var ChannelWeb_1 = require("./ChannelWeb"); | ||
exports.Channel = ChannelWeb_1.Channel; | ||
var Client_1 = require("./http/Client"); | ||
exports.HttpChannel = Client_1.HttpChannel; | ||
var Service_1 = require("./Service"); | ||
@@ -11,0 +15,0 @@ exports.Service = Service_1.Service; |
/** | ||
* index file for webpacke to generate bundle for web | ||
*/ | ||
import "core-js/modules/es6.promise"; | ||
import "core-js/modules/es6.symbol"; | ||
import "core-js/modules/es7.symbol.async-iterator"; | ||
export { Channel } from "./ChannelWeb"; | ||
export { HttpChannel } from "./http/Client"; | ||
export { Service } from "./Service"; | ||
@@ -7,0 +10,0 @@ export { ServiceFactory } from "./types"; |
@@ -6,5 +6,9 @@ "use strict"; | ||
*/ | ||
require("core-js/modules/es6.promise"); | ||
require("core-js/modules/es6.symbol"); | ||
require("core-js/modules/es7.symbol.async-iterator"); | ||
var ChannelWeb_1 = require("./ChannelWeb"); | ||
exports.Channel = ChannelWeb_1.Channel; | ||
var Client_1 = require("./http/Client"); | ||
exports.HttpChannel = Client_1.HttpChannel; | ||
var Service_1 = require("./Service"); | ||
@@ -11,0 +15,0 @@ exports.Service = Service_1.Service; |
@@ -48,3 +48,2 @@ "use strict"; | ||
case 0: | ||
console.log("[WSGRPC]channel.ws.create, endpoint: " + endpoint); | ||
if (options && options.cacert) { | ||
@@ -60,10 +59,10 @@ // cocos android native | ||
ws.onopen = function (event) { | ||
console.log("[WSGRPC]channel.ws.onopen"); | ||
// console.log("[WSGRPC]channel.ws.onopen"); | ||
future.resolve(ws); | ||
}; | ||
ws.onerror = function (event) { | ||
console.error("[WSGRPC]channel.ws.onerror"); | ||
// console.error("[WSGRPC]channel.ws.onerror"); | ||
}; | ||
ws.onclose = function (event) { | ||
console.error("[WSGRPC]channel.ws.onclose"); | ||
// console.error("[WSGRPC]channel.ws.onclose"); | ||
future.reject(new Error("open socket error")); | ||
@@ -77,3 +76,2 @@ }; | ||
_a.sent(); | ||
console.log("[WSGRPC]channel.ws.onopen continue"); | ||
protocol = new GrpcProtocol_1.GrpcProtocol(null); | ||
@@ -80,0 +78,0 @@ connection_1.startProtocal(protocol, ws); |
@@ -112,7 +112,7 @@ "use strict"; | ||
function onclose(protocol, event) { | ||
console.warn("websocket on close"); | ||
// console.warn("websocket on close"); | ||
protocol.connectionLost(null); | ||
} | ||
function onerror(protocol, event) { | ||
console.warn("websocket on error"); | ||
// console.warn("websocket on error"); | ||
} | ||
@@ -119,0 +119,0 @@ function onmessage(protocol, event) { |
@@ -22,3 +22,6 @@ "use strict"; | ||
if (this.closed) { | ||
console.log("[WSGRPC]WebsocketTransport.send: frame will be droped because ws has closed:", frame); | ||
// console.log( | ||
// "[WSGRPC]WebsocketTransport.send: frame will be droped because ws has closed:", | ||
// frame | ||
// ); | ||
//throw new Error("connection is closed"); | ||
@@ -40,4 +43,4 @@ return; | ||
var streamID = this.nextStreamID; | ||
this.nextStreamID += 2; | ||
this.sendHeaders(streamID, path); | ||
this.nextStreamID += 2; | ||
return streamID; | ||
@@ -44,0 +47,0 @@ }; |
{ | ||
"name": "wsgrpc", | ||
"version": "1.6.10", | ||
"version": "1.7.0", | ||
"description": "Using WebSocket as gRPC transport", | ||
@@ -16,2 +16,3 @@ "author": "tsangpo", | ||
"minimist": "^1.2.0", | ||
"node-fetch": "^2.6.0", | ||
"protobufjs": "6.8.8", | ||
@@ -18,0 +19,0 @@ "tmp": "0.0.33", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
300543
85
7412
7
5
+ Addednode-fetch@^2.6.0
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)