socket_protobuf
Advanced tools
Comparing version 1.1.7 to 1.1.8
@@ -33,10 +33,12 @@ import { ServerSocket } from "./ServerSocket"; | ||
private onConnectedCallback; | ||
private onDisconnectedCallback; | ||
constructor(host: Host); | ||
private onConnected; | ||
send(cmdId: number, newBuff: Uint8Array | Buffer): boolean; | ||
private onMessage; | ||
private onConnected; | ||
private disconnected; | ||
private onClose; | ||
private onEnd; | ||
private onError; | ||
startConnect(onServerInfo: (server: PServer) => void, clientInfo?: PServer, onConnected?: () => void): void; | ||
startConnect(onServerInfo: (server: PServer) => void, clientInfo?: PServer, onConnected?: () => void, onDisconnected?: () => void): void; | ||
private start; | ||
@@ -47,3 +49,2 @@ private doConnect; | ||
private onTimeOut; | ||
private onReconnect; | ||
private clearTimeOut; | ||
@@ -50,0 +51,0 @@ onGetServerInfo(server: PServer): void; |
@@ -27,2 +27,11 @@ "use strict"; | ||
} | ||
send(cmdId, newBuff) { | ||
if (this._is_init_ok) { | ||
return this.server.send(cmdId, newBuff); | ||
} | ||
return false; | ||
} | ||
async onMessage(buffer) { | ||
await this.handlerMgr.handleBuffer(buffer); | ||
} | ||
onConnected() { | ||
@@ -40,12 +49,9 @@ this._connect_stat = NetStatus.connected; | ||
} | ||
send(cmdId, newBuff) { | ||
if (this._is_init_ok) { | ||
return this.server.send(cmdId, newBuff); | ||
disconnected() { | ||
if (null != this.onDisconnectedCallback) { | ||
this.onDisconnectedCallback(); | ||
} | ||
return false; | ||
} | ||
async onMessage(buffer) { | ||
await this.handlerMgr.handleBuffer(buffer); | ||
} | ||
onClose() { | ||
this.disconnected(); | ||
this.lineLogErr("服务器---连接-对方关闭"); | ||
@@ -56,2 +62,3 @@ this.clearSocket(); | ||
onEnd() { | ||
this.disconnected(); | ||
this.lineLogErr("服务器---连接-对方结束"); | ||
@@ -62,2 +69,3 @@ this.clearSocket(); | ||
onError() { | ||
this.disconnected(); | ||
this.lineLogErr(this.lineInfo + " Sever服务器---连接错误"); | ||
@@ -67,3 +75,3 @@ this.clearSocket(); | ||
} | ||
startConnect(onServerInfo, clientInfo = null, onConnected = null) { | ||
startConnect(onServerInfo, clientInfo = null, onConnected = null, onDisconnected = null) { | ||
this.onServerInfo = onServerInfo; | ||
@@ -86,2 +94,3 @@ if (null == clientInfo) { | ||
this.onConnectedCallback = onConnected; | ||
this.onDisconnectedCallback = onDisconnected; | ||
this.start(); | ||
@@ -125,5 +134,2 @@ } | ||
this._connect_index++; | ||
this.onReconnect(); | ||
} | ||
onReconnect() { | ||
console.warn(this.lineInfo + `-------!!!已达到${this._connect_index}次连接尝试....`); | ||
@@ -130,0 +136,0 @@ this.start(); |
{ | ||
"name": "socket_protobuf", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "socket发送protobuf二进制流的SDK", | ||
@@ -5,0 +5,0 @@ "main": "App.js", |
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
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
45295
1255