use arraybuffer to ensure web compatibility

This commit is contained in:
David Zhao
2021-08-05 13:04:44 -07:00
parent 1ca8b3fa0c
commit 101849d0bb
+1
View File
@@ -7,6 +7,7 @@ import 'package:web_socket_channel/web_socket_channel.dart';
Future<WebSocketChannel> connectToWebSocket(Uri uri) {
var ws = WebSocket(uri.toString());
ws.binaryType = 'arraybuffer';
var completer = Completer<WebSocketChannel>();
ws.onOpen.first.then((_) {
completer.complete(HtmlWebSocketChannel(ws));