I'm developing a Flutter application that connects to a Laravel REVERB backend using WebSockets. I'm using the IOWebSocketChannel.connect method to establish the connection and the sink.add method to send a subscription message to the server.
Here's the relevant code from my main.dart file:
final channel = IOWebSocketChannel.connect(
'ws://localhost:8080/app/wdkuwjwxw78hbp6sax2c');
@override
void initState() {
super.initState();
channel.sink.add(json.encode({
"event": "pusher:subscribe",
"data": {"channel": "home"},
}));
}
every thing work ok , but after a delay im receiving the following error message:
{"event":"pusher:error","data":"{\"code\":4201,\"message\":\"Pong reply not received in time\"}"}
I understand that this error message indicates that the server did not respond to a ping message within a certain time frame. However, I'm not sure how to fix this issue.
Does anyone know why I might be receiving this error message and how I can resolve it? Any help would be greatly appreciated.