- Ably FAQs
- Realtime API and client libraries
- Platform support
-
Account billing and packages
-
General
-
Realtime API and client libraries
-
Troubleshooting
-
Channels
-
REST API and client libraries
-
Ably error codes
-
Account and app setup and configuration
-
Ably architecture, transports, and security
-
Performance and Redundancy
-
Push Notifications
-
Integrations
-
Migrating to Ably from an existing service
How to adjust the realtimeRequestTimeout to a higher value (on ably-js)
The realtimeRequestTimeout option is implemented in ably-js and will work as expected. However, it is not included in the TypeScript declaration as of ably-js 1.2.17, so:
- The option won’t appear in editor autocomplete
- If you’re using typescript you’ll see a compiler error if you try to use it.
A- If you are not using TypeScript:
Just use the realtimeRequestTimeout option as normal. It may not show up in your auto-completion but will still work as expected.
B- If you are using TypeScript:
There are two solutions to this.
1- The first and simplest solution is to cast your options to the Types.ClientOptions type. Here’s an example:
import * as Ably from 'ably';
const client = new Ably.Realtime({
realtimeRequestTimeout: 10000,
} as Ably.Types.ClientOptions);
2- The second and slightly more scalable solution is to write a typescript declaration which augments the Ably.Types.ClientOptions type. Please see below for an example of this:
import * as Ably from 'ably';
// You can put this anywhere in your TypeScript project, conventionally you would place it in a separate .d.ts file
declare module 'ably' {
namespace Types {
interface ClientOptions {
realtimeRequestTimeout: number;
}
}
}
const client = new Ably.Realtime({
realtimeRequestTimeout: 10000,
});