connectWebSocket function
The default transport: package:web_socket_channel, which picks the
browser or the IO implementation, so the same code runs in Flutter web,
mobile and desktop.
Implementation
Future<RealtimeSocket> connectWebSocket(Uri uri) async {
final channel = WebSocketChannel.connect(uri);
await channel.ready;
return _ChannelSocket(channel);
}