Skip to content

Commit

Permalink
Switching off network provider on iOS does not immediately stop WebSo…
Browse files Browse the repository at this point in the history
…cket connection
  • Loading branch information
sashapetterson authored and sashapetterson committed Feb 5, 2025
1 parent abc7151 commit 9afe566
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/src/connect_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Future<WebSocketChannel> connect(StompConfig config) async {
var webSocketFuture = WebSocket.connect(
config.connectUrl,
headers: config.webSocketConnectHeaders,
).then((webSocket) => webSocket..pingInterval = config.heartbeatOutgoing);
);

if (config.connectionTimeout.inMilliseconds > 0) {
webSocketFuture = webSocketFuture.timeout(config.connectionTimeout);
Expand Down
8 changes: 4 additions & 4 deletions lib/src/stomp_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class StompConfig {
final StompDebugCallback onDebugMessage;

/// The transport url of the WebSocket to connect to
String get connectUrl =>
_connectUrl ??= useSockJS ? SockJsUtils().generateTransportUrl(url) : url;
String get connectUrl => _connectUrl ??= useSockJS ? SockJsUtils().generateTransportUrl(url) : url;

String? _connectUrl;

Expand Down Expand Up @@ -128,6 +127,7 @@ class StompConfig {
Duration? heartbeatIncoming,
Duration? heartbeatOutgoing,
Duration? connectionTimeout,
Duration? pingInterval,
bool? useSockJS,
Map<String, String>? stompConnectHeaders,
Map<String, dynamic>? webSocketConnectHeaders,
Expand All @@ -148,9 +148,9 @@ class StompConfig {
heartbeatIncoming: heartbeatIncoming ?? this.heartbeatIncoming,
heartbeatOutgoing: heartbeatOutgoing ?? this.heartbeatOutgoing,
connectionTimeout: connectionTimeout ?? this.connectionTimeout,
pingInterval: pingInterval ?? this.pingInterval,
useSockJS: useSockJS ?? this.useSockJS,
webSocketConnectHeaders:
webSocketConnectHeaders ?? this.webSocketConnectHeaders,
webSocketConnectHeaders: webSocketConnectHeaders ?? this.webSocketConnectHeaders,
stompConnectHeaders: stompConnectHeaders ?? this.stompConnectHeaders,
beforeConnect: beforeConnect ?? this.beforeConnect,
onConnect: onConnect ?? this.onConnect,
Expand Down

0 comments on commit 9afe566

Please sign in to comment.