Skip to content

Commit 674918b

Browse files
author
Dimitar Tachev
authored
Merge pull request #4258 from NativeScript/tachev/fix-sidekick-issues
fix: suggest manual app start instead of crashing on ios debug socket connection errors
2 parents 7b4d2b7 + acc5a42 commit 674918b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/device-sockets/ios/app-debug-socket-proxy-factory.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,23 @@ export class AppDebugSocketProxyFactory extends EventEmitter implements IAppDebu
110110
const server = new ws.Server(<any>{
111111
port: localPort,
112112
host: "localhost",
113-
verifyClient: async (info: any, callback: Function) => {
113+
verifyClient: async (info: any, callback: (res: boolean, code?: number, message?: string) => void) => {
114+
let acceptHandshake = true;
114115
this.$logger.info("Frontend client connected.");
115116
let appDebugSocket;
116117
try {
117118
appDebugSocket = await device.getDebugSocket(appId);
119+
this.$logger.info("Backend socket created.");
120+
info.req["__deviceSocket"] = appDebugSocket;
118121
} catch (err) {
119122
err.deviceIdentifier = device.deviceInfo.identifier;
120123
this.$logger.trace(err);
121124
this.emit(CONNECTION_ERROR_EVENT_NAME, err);
122-
this.$errors.failWithoutHelp(`Cannot connect to device socket.The error message is ${err.message} `);
125+
acceptHandshake = false;
126+
this.$logger.warn(`Cannot connect to device socket. The error message is '${err.message}'. Try starting the application manually.`);
123127
}
124128

125-
this.$logger.info("Backend socket created.");
126-
info.req["__deviceSocket"] = appDebugSocket;
127-
callback(true);
129+
callback(acceptHandshake);
128130
}
129131
});
130132
this.deviceWebServers[cacheKey] = server;

0 commit comments

Comments
 (0)