web_socket_channel_connect 1.0.4 copy "web_socket_channel_connect: ^1.0.4" to clipboard
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) {});
}```
5
likes
120
points
46
downloads

Publisher

verified publisherpeifferinnovations.com

Weekly Downloads

A wrapper to connect websockets for the web_socket_channel package that gives an error on failure.

Documentation

API reference

License

MIT (license)

Dependencies

web_socket_channel

More

Packages that depend on web_socket_channel_connect