decline & accept devices and protocol connection issues fixed
This commit is contained in:
@@ -26,6 +26,7 @@ import { PacketGroupLeave } from "./packets/packet.group.leave";
|
||||
import { PacketGroupBan } from "./packets/packet.group.ban";
|
||||
import { PacketDeviceNew } from "./packets/packet.device.new";
|
||||
import { PacketDeviceList } from "./packets/packet.device.list";
|
||||
import { PacketDeviceResolve } from "./packets/packet.device.resolve";
|
||||
|
||||
export default class Protocol extends EventEmitter {
|
||||
private serverAddress: string;
|
||||
@@ -122,6 +123,7 @@ export default class Protocol extends EventEmitter {
|
||||
this._supportedPackets.set(0x15, new PacketGroupLeave());
|
||||
this._supportedPackets.set(0x16, new PacketGroupBan());
|
||||
this._supportedPackets.set(0x17, new PacketDeviceList());
|
||||
this._supportedPackets.set(0x18, new PacketDeviceResolve());
|
||||
}
|
||||
|
||||
private _findWaiters(packetId: number): ((packet: Packet) => void)[] {
|
||||
@@ -133,6 +135,11 @@ export default class Protocol extends EventEmitter {
|
||||
|
||||
public connect() {
|
||||
this.socket = new WebSocket(this.serverAddress);
|
||||
/**
|
||||
* Сбрасываем флаг ручного закрытия соединения
|
||||
* при подключении
|
||||
*/
|
||||
this.isManuallyClosed = false;
|
||||
|
||||
this.socket.addEventListener('open', () => {
|
||||
//this.reconnectTryings = 0;
|
||||
|
||||
Reference in New Issue
Block a user