... web_socket_channel: ^2.4.0
void main() async {
final wsUrl = Uri.parse('ws://localhost:2335');
final channel = WebSocketChannel.connect(wsUrl);
await channel.ready;
channel.sink.add('Hello Server!');
channel.stream.listen((message) {
print('Message from server "$message"');
});
}
From web (Chrome and Edge) all working fine. From Windows app freezing on this code:
await channel.ready;
No exception in flutter app. On server side only event OnConnect, data is not received
flutter doctor:
[√] Flutter (Channel stable, 3.16.5, on Microsoft Windows [Version 10.0.22621.2861], locale ru-UA)
• Flutter version 3.16.5 on channel stable at D:\sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 78666c8dc5 (9 days ago), 2023-12-19 16:14:14 -0800
• Engine revision 3f3e560236
• Dart version 3.2.3
• DevTools version 2.28.4
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at D:\sdk\Android\sdk
• Platform android-33, build-tools 31.0.0
• ANDROID_HOME = D:\sdk\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.4.33205.214
• Windows 10 SDK version 10.0.22000.0
[√] Android Studio (version 2021.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] VS Code (version 1.78.1)
• VS Code at C:\Users\Николай\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.62.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2861]
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.130
• Edge (web) • edge • web-javascript • Microsoft Edge 120.0.2210.91
[√] Network resources
• All expected network resources are available.
I have a simple WebSocket server on Delphi. Connection from JS is working fine:
Now I create test app on flutter (from example):
import 'package:web_socket_channel/web_socket_channel.dart';
From web (Chrome and Edge) all working fine. From Windows app freezing on this code:
await channel.ready;
No exception in flutter app. On server side only event OnConnect, data is not received
flutter doctor: