Skip to content

Commit fa5b814

Browse files
display warning when socket.io fails
1 parent 1c05034 commit fa5b814

3 files changed

Lines changed: 33 additions & 6 deletions

File tree

src/providers/espresso.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default class Espresso extends BaseProvider<EspressoOptions> {
5252
private socket: Socket | null = null;
5353
private updateServer: string | null = null;
5454
private updateKey: string | null = null;
55+
private socketFallbackWarned = false;
5556

5657
public constructor(credentials: Credentials, options: EspressoOptions) {
5758
super(credentials, options);
@@ -539,8 +540,16 @@ export default class Espresso extends BaseProvider<EspressoOptions> {
539540
this.handleEspressoError(data);
540541
});
541542

542-
this.socket.on('connect_error', () => {
543-
// Silently fail - real-time updates are optional
543+
this.socket.on('connect_error', (err: Error) => {
544+
if (!this.socketFallbackWarned) {
545+
this.socketFallbackWarned = true;
546+
logger.warn(
547+
'Real-time log stream unavailable, falling back to polling.',
548+
);
549+
logger.debug(
550+
`Socket connect_error: ${err?.message ?? 'unknown error'}`,
551+
);
552+
}
544553
this.disconnectFromUpdateServer();
545554
});
546555
} catch {

src/providers/maestro.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export default class Maestro extends BaseProvider<MaestroOptions> {
9393
private socket: Socket | null = null;
9494
private updateServer: string | null = null;
9595
private updateKey: string | null = null;
96+
private socketFallbackWarned = false;
9697

9798
public constructor(credentials: Credentials, options: MaestroOptions) {
9899
super(credentials, options);
@@ -2580,8 +2581,16 @@ export default class Maestro extends BaseProvider<MaestroOptions> {
25802581
this.handleMaestroError(data);
25812582
});
25822583

2583-
this.socket.on('connect_error', () => {
2584-
// Silently fail - real-time updates are optional
2584+
this.socket.on('connect_error', (err: Error) => {
2585+
if (!this.socketFallbackWarned) {
2586+
this.socketFallbackWarned = true;
2587+
logger.warn(
2588+
'Real-time log stream unavailable, falling back to polling.',
2589+
);
2590+
logger.debug(
2591+
`Socket connect_error: ${err?.message ?? 'unknown error'}`,
2592+
);
2593+
}
25852594
this.disconnectFromUpdateServer();
25862595
});
25872596
} catch {

src/providers/xcuitest.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default class XCUITest extends BaseProvider<XCUITestOptions> {
5252
private socket: Socket | null = null;
5353
private updateServer: string | null = null;
5454
private updateKey: string | null = null;
55+
private socketFallbackWarned = false;
5556

5657
public constructor(credentials: Credentials, options: XCUITestOptions) {
5758
super(credentials, options);
@@ -542,8 +543,16 @@ export default class XCUITest extends BaseProvider<XCUITestOptions> {
542543
this.handleXCUITestError(data);
543544
});
544545

545-
this.socket.on('connect_error', () => {
546-
// Silently fail - real-time updates are optional
546+
this.socket.on('connect_error', (err: Error) => {
547+
if (!this.socketFallbackWarned) {
548+
this.socketFallbackWarned = true;
549+
logger.warn(
550+
'Real-time log stream unavailable, falling back to polling.',
551+
);
552+
logger.debug(
553+
`Socket connect_error: ${err?.message ?? 'unknown error'}`,
554+
);
555+
}
547556
this.disconnectFromUpdateServer();
548557
});
549558
} catch {

0 commit comments

Comments
 (0)