Unable to communicate regardless of successful connection
- Dominant language
- Dart
- Stars
- 1.1k
- Forks
- 419
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 8
Description
Hi,
I've created a quite simple code for testing the capabilities of the websocket via Flutter web.
On the server-side, I'm using the SimpleWebsocketServer python module.
I can connect to the server but I can't send anything there, it doesn't arrive but there is no error on any side.
Here is my client code (Flutter web)
```
start() async {
HtmlWebSocketChannel channel;
while (true) {
try {
if (channel == null || channel.closeCode != null) {
channel = HtmlWebSocketChannel.connect("ws://localhost:8000");
channel.stream.listen((message) {
print(message);
});
channel.stream.handleError((error) {
print(error);
});
}
channel.sink.add("Test message");
} catch (e) {
print(e);
}
}
}
```
Here is my server code (Python):
```
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
class SimpleEcho(WebSocket):
def handleMessage(self):
# echo message back to client
print(self.data)
self.sendMessage(self.data)
def handleConnected(self):
print(self.address, 'connected')
def handleClose(self):
print(self.address, 'closed')
server = SimpleWebSocketServer('', 8000, SimpleEcho)
server.serveforever()
```
Here you can find the Wireshark log: https://drive.google.com/file/d/1k_pmXIkBEhojl8FYj6X29ZH2pWx9xcFz/view?usp=sharing
And here is a screenshot of the relevant part of the Wireshark log:

Is there any idea why it doesn't work?
Contributor guide
Research direction
Start by reproducing the Flutter web client with the shown HtmlWebSocketChannel code and the Python SimpleWebSocketServer example, then inspect the linked Wireshark capture. Compare connection, send, and receive behavior; done means the server prints "Test message" and the client receives the echoed message without silent failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100