web_socket_channel_connect 1.0.2+1 web_socket_channel_connect: ^1.0.2+1 copied to clipboard
A wrapper to connect websockets for the web_socket_channel package that gives an error on failure.
web_socket_channel_connect #
Table of Contents
Introduction #
A small wrapper for the web_socket_channel package that throws a synchronous error if the connection fails.
This addresses the following open issues on the web_socket_channel package:
- https://github.com/dart-lang/web_socket_channel/issues/226
- https://github.com/dart-lang/web_socket_channel/issues/220
- https://github.com/dart-lang/web_socket_channel/issues/214
- https://github.com/dart-lang/web_socket_channel/issues/209
Usage #
import 'package:web_socket_channel_connect/web_socket_channel_connect.dart';
Future<void> main() async {
final channel = connectWebSocket(Uri.parse('ws:localhost:5333'));
channel.stream.listen((message) {});
}