Skip to content

Commit a00e077

Browse files
authored
Make isInKeepAlivePeriod as private (flutter#20)
* Make isInKeepAlivePeriod as private * fix doc * fix markdown
1 parent 850b7bc commit a00e077

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 3.1.1
2+
3+
- Make `isInKeepAlive` on `SseConnection` private.
4+
5+
**Note that this is a breaking change but in actuality no one should be
6+
depending on this API.**
7+
18
## 3.1.0
29

310
- Add optional `keepAlive` parameter to the `SseHandler`. If `keepAlive` is
@@ -9,8 +16,8 @@
916

1017
- Add retry logic.
1118

12-
** Possible Breaking Change ** Error messages may now be delayed up to 5 seconds
13-
in the client.
19+
**Possible Breaking Change Error messages may now be delayed up to 5 seconds
20+
in the client.**
1421

1522
## 2.1.2
1623

lib/src/server/sse_handler.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SseConnection extends StreamChannelMixin<String> {
3737
Timer _keepAliveTimer;
3838

3939
/// Whether this connection is currently in the KeepAlive timeout period.
40-
bool get isInKeepAlivePeriod => _keepAliveTimer?.isActive ?? false;
40+
bool get _isInKeepAlivePeriod => _keepAliveTimer?.isActive ?? false;
4141

4242
final _closedCompleter = Completer<void>();
4343

@@ -60,7 +60,7 @@ class SseConnection extends StreamChannelMixin<String> {
6060
while (await outgoingStreamQueue.hasNext) {
6161
// If we're in a KeepAlive timeout, there's nowhere to send messages so
6262
// wait a short period and check again.
63-
if (isInKeepAlivePeriod) {
63+
if (_isInKeepAlivePeriod) {
6464
await Future.delayed(const Duration(milliseconds: 200));
6565
continue;
6666
}
@@ -105,7 +105,7 @@ class SseConnection extends StreamChannelMixin<String> {
105105
if (_keepAlive == null) {
106106
// Close immediately if we're not keeping alive.
107107
_close();
108-
} else if (!isInKeepAlivePeriod) {
108+
} else if (!_isInKeepAlivePeriod) {
109109
// Otherwise if we didn't already have an active timer, set a timer to
110110
// close after the timeout period. If the connection comes back, this will
111111
// be cancelled and all messages left in the queue tried again.
@@ -155,7 +155,7 @@ class SseHandler {
155155
// Check if we already have a connection for this ID that is in the process
156156
// of timing out (in which case we can reconnect it transparently).
157157
if (_connections[clientId] != null &&
158-
_connections[clientId].isInKeepAlivePeriod) {
158+
_connections[clientId]._isInKeepAlivePeriod) {
159159
_connections[clientId]._acceptReconnection(sink);
160160
} else {
161161
var connection = SseConnection(sink, keepAlive: _keepAlive);

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sse
2-
version: 3.1.0
2+
version: 3.1.1
33
author: Dart Team <[email protected]>
44
homepage: https://github.com/dart-lang/sse
55
description: >-

0 commit comments

Comments
 (0)