UNPKG

appium-remote-debugger

Version:
48 lines 1.74 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const logger_1 = __importDefault(require("../logger")); const rpc_client_1 = __importDefault(require("./rpc-client")); const appium_ios_device_1 = require("appium-ios-device"); class RpcClientRealDevice extends rpc_client_1.default { constructor(opts = {}) { super(Object.assign({ shouldCheckForTarget: false, }, opts)); } async connect() { this.service = await appium_ios_device_1.services.startWebInspectorService(this.udid, { osVersion: this.platformVersion, isSimulator: false, verbose: this.logAllCommunication, verboseHexDump: this.logAllCommunicationHexDump, socketChunkSize: this.socketChunkSize, maxFrameLength: this.webInspectorMaxFrameLength, }); this.service.listenMessage(this.receive.bind(this)); this.isConnected = true; } async disconnect() { if (!this.isConnected) { return; } logger_1.default.debug('Disconnecting from remote debugger'); await super.disconnect(); this.service.close(); this.isConnected = false; } async sendMessage(cmd) { this.service.sendMessage(cmd); } async receive(data) { if (!this.isConnected) { return; } // @ts-ignore messageHandler must be defined here await this.messageHandler.handleMessage(data); } } exports.default = RpcClientRealDevice; //# sourceMappingURL=rpc-client-real-device.js.map