Skip to content

Commit 4d96d47

Browse files
authored
Merge branch 'master' into nextgen
2 parents bcafd10 + 25fa1da commit 4d96d47

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/src/socket_options.dart

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class PhoenixSocketOptions {
1313
/// The interval between heartbeat roundtrips
1414
Duration? heartbeat,
1515

16+
/// The duration after which a heartbeat request
17+
/// is considered timed out
18+
Duration? heartbeatTimeout,
19+
1620
/// The list of delays between reconnection attempts.
1721
///
1822
/// The last duration will be repeated until it works.
@@ -40,6 +44,7 @@ class PhoenixSocketOptions {
4044
}) : _timeout = timeout ?? const Duration(seconds: 10),
4145
serializer = serializer ?? const MessageSerializer(),
4246
_heartbeat = heartbeat ?? const Duration(seconds: 30),
47+
_heartbeatTimeout = heartbeatTimeout ?? const Duration(seconds: 10),
4348
assert(!(params != null && dynamicParams != null),
4449
"Can't set both params and dynamicParams");
4550

@@ -49,13 +54,19 @@ class PhoenixSocketOptions {
4954

5055
final Duration _timeout;
5156
final Duration _heartbeat;
57+
final Duration _heartbeatTimeout;
5258

5359
/// Duration after which a request is assumed to have timed out.
5460
Duration get timeout => _timeout;
5561

5662
/// Duration between heartbeats
5763
Duration get heartbeat => _heartbeat;
5864

65+
/// Duration after which a heartbeat request is considered timed out.
66+
/// If the server does not respond to a heartbeat request within this
67+
/// duration, the connection is considered lost.
68+
Duration get heartbeatTimeout => _heartbeatTimeout;
69+
5970
/// Optional list of Duration between reconnect attempts
6071
final List<Duration> reconnectDelays;
6172

0 commit comments

Comments
 (0)