Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: errors during debug on iOS #4286

Merged
merged 3 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/device-sockets/ios/app-debug-socket-proxy-factory.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EventEmitter } from "events";
import { CONNECTION_ERROR_EVENT_NAME } from "../../constants";
import { PacketStream } from "./packet-stream";
import * as net from "net";
import * as ws from "ws";
import temp = require("temp");
import { MessageUnpackStream } from "ios-device-lib";

export class AppDebugSocketProxyFactory extends EventEmitter implements IAppDebugSocketProxyFactory {
private deviceWebServers: IDictionary<ws.Server> = {};
Expand Down Expand Up @@ -134,11 +134,16 @@ export class AppDebugSocketProxyFactory extends EventEmitter implements IAppDebu
const encoding = "utf16le";

const appDebugSocket: net.Socket = (<any>req)["__deviceSocket"];
const packets = new PacketStream();
const packets = new MessageUnpackStream();
appDebugSocket.pipe(packets);

packets.on("data", (buffer: Buffer) => {
webSocket.send(buffer.toString(encoding));
const message = buffer.toString(encoding);
if (webSocket.readyState === webSocket.OPEN) {
webSocket.send(message);
} else {
this.$logger.trace(`Received message ${message}, but unable to send it to webSocket as its state is: ${webSocket.readyState}`);
}
});

webSocket.on("error", err => {
Expand Down
33 changes: 0 additions & 33 deletions lib/device-sockets/ios/packet-stream.ts

This file was deleted.

6 changes: 3 additions & 3 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"gaze": "1.1.0",
"iconv-lite": "0.4.11",
"inquirer": "6.2.0",
"ios-device-lib": "0.4.15",
"ios-device-lib": "0.5.0",
"ios-mobileprovision-finder": "1.0.10",
"ios-sim-portable": "4.0.6",
"istextorbinary": "2.2.1",
Expand Down