File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
packages/graphql/lib/src/links/websocket_link Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -637,8 +637,14 @@ class GraphQLWebSocketChannel extends StreamChannelMixin<dynamic>
637
637
Stream <GraphQLSocketMessage >? _messages;
638
638
639
639
/// Stream of messages from the endpoint parsed as GraphQLSocketMessages
640
- Stream <GraphQLSocketMessage > get messages => _messages ?? =
641
- stream.map <GraphQLSocketMessage >(GraphQLSocketMessage .parse);
640
+ Stream <GraphQLSocketMessage > get messages {
641
+ if (_messages == null )
642
+ _messages = stream.map ((event) {
643
+ return GraphQLSocketMessage .parse (event);
644
+ }).asBroadcastStream ();
645
+
646
+ return _messages! ;
647
+ }
642
648
643
649
String ? get protocol => _webSocket.protocol;
644
650
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ class WebSocketLink extends Link {
45
45
);
46
46
}
47
47
48
+ SocketClient ? get getSocketClient => _socketClient;
49
+
48
50
/// Disposes the underlying socket client explicitly. Only use this, if you want to disconnect from
49
51
/// the current server in favour of another one. If that's the case, create a new [WebSocketLink] instance.
50
52
Future <void > dispose () async {
You can’t perform that action at this time.
0 commit comments