@@ -13,6 +13,10 @@ class PhoenixSocketOptions {
13
13
/// The interval between heartbeat roundtrips
14
14
Duration ? heartbeat,
15
15
16
+ /// The duration after which a heartbeat request
17
+ /// is considered timed out
18
+ Duration ? heartbeatTimeout,
19
+
16
20
/// The list of delays between reconnection attempts.
17
21
///
18
22
/// The last duration will be repeated until it works.
@@ -40,6 +44,7 @@ class PhoenixSocketOptions {
40
44
}) : _timeout = timeout ?? const Duration (seconds: 10 ),
41
45
serializer = serializer ?? const MessageSerializer (),
42
46
_heartbeat = heartbeat ?? const Duration (seconds: 30 ),
47
+ _heartbeatTimeout = heartbeatTimeout ?? const Duration (seconds: 10 ),
43
48
assert (! (params != null && dynamicParams != null ),
44
49
"Can't set both params and dynamicParams" );
45
50
@@ -49,13 +54,19 @@ class PhoenixSocketOptions {
49
54
50
55
final Duration _timeout;
51
56
final Duration _heartbeat;
57
+ final Duration _heartbeatTimeout;
52
58
53
59
/// Duration after which a request is assumed to have timed out.
54
60
Duration get timeout => _timeout;
55
61
56
62
/// Duration between heartbeats
57
63
Duration get heartbeat => _heartbeat;
58
64
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
+
59
70
/// Optional list of Duration between reconnect attempts
60
71
final List <Duration > reconnectDelays;
61
72
0 commit comments