Skip to content

Commit

Permalink
Merge pull request #1404 from szantogab/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
vincenzopalazzo authored Mar 31, 2024
2 parents 41cd27e + 694aa26 commit 6dd5d6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,14 @@ class GraphQLWebSocketChannel extends StreamChannelMixin<dynamic>
Stream<GraphQLSocketMessage>? _messages;

/// Stream of messages from the endpoint parsed as GraphQLSocketMessages
Stream<GraphQLSocketMessage> get messages => _messages ??=
stream.map<GraphQLSocketMessage>(GraphQLSocketMessage.parse);
Stream<GraphQLSocketMessage> get messages {
if (_messages == null)
_messages = stream.map((event) {
return GraphQLSocketMessage.parse(event);
}).asBroadcastStream();

return _messages!;
}

String? get protocol => _webSocket.protocol;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class WebSocketLink extends Link {
);
}

SocketClient? get getSocketClient => _socketClient;

/// Disposes the underlying socket client explicitly. Only use this, if you want to disconnect from
/// the current server in favour of another one. If that's the case, create a new [WebSocketLink] instance.
Future<void> dispose() async {
Expand Down

0 comments on commit 6dd5d6e

Please sign in to comment.