Skip to content

Commit

Permalink
Merge pull request #13 from takenet/feature/398343-offline-behavior
Browse files Browse the repository at this point in the history
[Feature] 398343 - Offline Behavior
  • Loading branch information
mpamaro authored Feb 6, 2023
2 parents d1bedc8 + 4a62abb commit 149356c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.21

* Override socket field in WebSocketTransport class

## 0.0.20

* Changed onConnectionDone listener to be mutable instead of final.
Expand Down
4 changes: 4 additions & 0 deletions lib/src/protocol/network/transport.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';

import '../enums/session_compression.enum.dart';
import '../enums/session_encryption.enum.dart';
Expand All @@ -20,6 +21,9 @@ abstract class Transport extends EnvelopeListener {
/// Allows sends an envelope to the connected node.
void send(Envelope envelope);

/// A websocket for communication
WebSocket? socket;

/// Enumerates the supported compression options for the transport.
SessionCompression? compression;

Expand Down
18 changes: 9 additions & 9 deletions lib/src/protocol/network/web_socket_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@ class WebSocketTransport implements Transport {
StreamController<Map<String, dynamic>>? onEnvelopeStream =
StreamController<Map<String, dynamic>>();

StreamController<bool>? onConnectionDoneStream = StreamController<bool>();

/// A websocket for communication
@override
WebSocket? socket;

@override
SessionCompression? compression;

@override
SessionEncryption? encryption;

/// Allows saving the Session id
String? sessionId;

/// A [StreamController] to allow listening when the close method is executed
@override
StreamController<bool> onClose = StreamController<bool>();

StreamController<bool>? onConnectionDoneStream = StreamController<bool>();

final logger = LoggerService();

@override
Expand Down Expand Up @@ -139,12 +145,6 @@ class WebSocketTransport implements Transport {
onConnectionDoneStream = _onConnectionDone;
}

@override
SessionCompression? compression;

@override
SessionEncryption? encryption;

Future<List<int>> _getKeyBytes() async {
return (await rootBundle
.load('packages/${LimeUtils.packageName}/assets/keys/private.key'))
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -529,5 +529,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.18.0 <4.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=1.17.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: lime
description: LIME Protocol for Dart/Flutter - A lightweight messaging library
version: 0.0.20
version: 0.0.21
homepage: https://limeprotocol.org/
repository: https://github.com/takenet/lime-dart

Expand Down

0 comments on commit 149356c

Please sign in to comment.