Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

peiffer-innovations/web_socket_channel_connect

Repository files navigation

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) {});
}```