Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
01323bd
fix: retry the socket when the first connect attempt fails
OtavioStasiak Oct 23, 2026
4fac4ab
test: make the superseded-connect retry test depend on the driver guard
OtavioStasiak Oct 23, 2026
649457a
cleanup
OtavioStasiak Oct 26, 2026
cd8c32d
cleanup
OtavioStasiak Oct 26, 2026
617f914
Merge branch 'develop' into fix.connection-issue-ios
OtavioStasiak Oct 26, 2026
4bb8179
fix: let the SDK reopen after a failed connect instead of forcing a r…
OtavioStasiak Nov 25, 2026
688af7e
Merge remote-tracking branch 'origin/develop' into fix.connection-iss…
OtavioStasiak Nov 25, 2026
4eeb2be
test: make the replaced-connect test wait out the reopen delay
OtavioStasiak Nov 25, 2026
bccf174
chore: pin the sdk to the commit that reopens after a failed open
OtavioStasiak Nov 25, 2026
d453727
fix: abort a client's requests when it is disconnected so a pending l…
OtavioStasiak Nov 25, 2026
62dbd7b
fix: clear a failed or pending login when a server is selected
OtavioStasiak Nov 25, 2026
0da7634
test: share the REST login response
OtavioStasiak Nov 25, 2026
246c55c
revert: keep the PR to the reopen after a failed connect
OtavioStasiak Nov 25, 2026
c4c8209
test: share the failed-first-attempt setup
OtavioStasiak Nov 25, 2026
ba59a49
test: drop the reopenNow recovery test that passes without the fix
OtavioStasiak Nov 25, 2026
4c3286d
chore: pin the SDK to the merged reopenAfterFailedOpen commit
OtavioStasiak Nov 26, 2026
3745146
Merge branch 'develop' into fix.connection-issue-ios
OtavioStasiak Nov 26, 2026
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
38 changes: 38 additions & 0 deletions app/lib/services/__tests__/connect.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ async function connectAndDriveHandshake(server = 'https://example.com') {
await flushMicrotasksAndTimers();
}

async function connectAndFailFirstAttempt(server = 'https://example.com') {
await connect({ server });
await flushMicrotasksAndTimers();
mockConnections[0].onerror();
await flushMicrotasksAndTimers();
}

describe('connect() over the real SDK', () => {
it('dispatches connectRequest when connecting and connectSuccess once on the handshake', async () => {
await connectAndDriveHandshake();
Expand Down Expand Up @@ -177,6 +184,37 @@ describe('connect() over the real SDK', () => {

expect(successCount()).toBe(before);
});

it('keeps retrying when the first attempt fails and connects once the network is back', async () => {
await connectAndFailFirstAttempt();
expect(mockConnections).toHaveLength(1);

await jest.runOnlyPendingTimersAsync();
await flushMicrotasksAndTimers();
expect(mockConnections).toHaveLength(2);
mockConnections[1].onerror();
await flushMicrotasksAndTimers();
expect(mockConnections).toHaveLength(2);

await jest.runOnlyPendingTimersAsync();
await flushMicrotasksAndTimers();
expect(mockConnections).toHaveLength(3);
mockConnections[2].onopen();
await flushMicrotasksAndTimers();

expect(redux.store.dispatch).toHaveBeenCalledWith(connectSuccess());
});

it('does not retry an attempt that a later connect() replaced', async () => {
Comment thread
OtavioStasiak marked this conversation as resolved.
Resolved
await connectAndFailFirstAttempt('https://a.example.com');

await connect({ server: 'https://b.example.com' });
await flushMicrotasksAndTimers();
await jest.runOnlyPendingTimersAsync();
await flushMicrotasksAndTimers();

expect(mockConnections).toHaveLength(2);
});
});

describe('login() over the real SDK', () => {
Expand Down
8 changes: 7 additions & 1 deletion app/lib/services/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ class Sdk {

private initializeSdk(server: string): Rocketchat {
// The app can't reconnect if reopen interval is 5s while in development
return new Rocketchat({ host: server, protocol: 'ddp', useSsl: isSsl(server), reopen: __DEV__ ? 20000 : 5000 });
return new Rocketchat({
host: server,
protocol: 'ddp',
useSsl: isSsl(server),
reopen: __DEV__ ? 20000 : 5000,
reopenAfterFailedOpen: true
Comment thread
OtavioStasiak marked this conversation as resolved.
Resolved
});
}

initialize(server: string): void {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@rocket.chat/media-signaling": "1.0.0-rc.1",
"@rocket.chat/message-parser": "0.31.36",
"@rocket.chat/mobile-crypto": "RocketChat/rocket.chat-mobile-crypto#main",
"@rocket.chat/sdk": "RocketChat/Rocket.Chat.js.SDK#59708d7b48aace43ef65b16de101fc12a96b69aa",
"@rocket.chat/sdk": "RocketChat/Rocket.Chat.js.SDK#e90a19ffff954c4f86a337940de19cc6b29d0be8",
"@rocket.chat/ui-kit": "^0.39.0",
"@zoontek/react-native-navigation-bar": "^1.1.1",
"axios": "0.30.3",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

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

Loading