5

I'm using Beyondco Larevel Websockets on my Laravel Backend, and using pusher_client and laravel_echo on my Flutter frontend.

I've been trying to connect from my ios simulator into my Laravel Backend host, which is using valet secure, but failing.

My Flutter connections:

PusherClient getPusherClient(String token) {
  PusherOptions options = PusherOptions(
      host: 'my-local-server.test',
      wsPort: 6001,
      wssPort: 6001,
      cluster: DotEnv.env['PUSHER_APP_CLUSTER'],
      encrypted: true,
      auth: PusherAuth('https://my-local-server.test/api/broadcasting/auth',
          headers: {'Authorization': 'Bearer $token'})
  );

  return PusherClient(DotEnv.env['PUSHER_APP_KEY'], options,
      enableLogging: true, autoConnect: false);
}
pusherClient = getPusherClient(token);
pusherClient.connect();
pusherClient.onConnectionStateChange((state) {
  print(
      "previousState: ${state.previousState}, currentState: ${state.currentState}");
});
pusherClient.onConnectionError((error) {
  print(error.message);
});

From https://my-local-server.test/laravel-websockets I never see the requests from Flutter, but if I fire an event from my Laravel backend, it gets logged.

Please help me with what's wrong in my setup, why I can't connect to my SSL valet server running laravel-websocket from my Flutter application.

doydoy
  • 4,021
  • 3
  • 20
  • 33
Lambasoft
  • 909
  • 2
  • 14
  • 33

0 Answers0