web_socket_channel_connect 1.0.4 web_socket_channel_connect: ^1.0.4 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 #
DEPRECATED: This package is deprecated and no longer necessary since web_socket_channel version 2.3.0
.
Old method #
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) {});
}
New method #
import 'package:web_socket_channel/web_socket_channel.dart';
main() async {
final wsUrl = Uri.parse('ws:localhost:5333');
final channel = WebSocketChannel.connect(wsUrl);
await channel.ready;
channel.stream.listen((message) {});
}```