1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Laravel echo null and sockets in Flutter

Discussão em 'Mobile' iniciado por Stack, Novembro 6, 2024 às 07:52.

  1. Stack

    Stack Membro Participativo

    So I was trying to use Laravel echo null package and it's connecting and it sends the data I give I can see it in the web version of the app which is built using vue js but here when I'm listening to the channel it doesn't print anything how can I listen to it correctly? and also this package has an issue with IOS it give me this error :

    [!] No podspec found for `pusher_client_fixed` in `.symlinks/plugins/pusher_client_fixed/ios`


    so do you know any other package to do the same? I tried using web sockets channel but it just says the connection was established Here's my code:

    Echo<PusherClient, PusherChannel> echo =
    Echo<PUSHER.PusherClient, PusherChannel>(PusherConnector(
    'akm',
    authEndPoint:
    'https://api.akm-r.com/broadcasting/auth', // String?: auth host
    authHeaders: {
    // authenticate headers
    'Authorization': 'Bearer ${Helpers.readUserData()?.token}',
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    },
    // cluster: 'mt1', // String?: pusher cluster
    host: 'api.akm-r.com',
    wsPort: 443,
    wssPort: 443,
    encrypted: true,
    activityTimeout: 120000,
    pongTimeout: 30000,
    maxReconnectionAttempts: 6,
    maxReconnectGapInSeconds: 30,
    enableLogging: true,
    autoConnect: true, // bool: client connection automatically
    // nameSpace: 'nameSpace',
    ));

    _connect() {
    print('soket id ${echo.socketId}');
    echo.connect();
    echo.private('session.11111').subscribe();
    echo.private('session.11111').onSubscribedSuccess(() {
    print('subscribe');
    });
    echo.private('session.11111').listen('drivers.11111', (d) {
    print('listen $d');
    }).listenForWhisper('drivers.11111', (d) {
    print('here');
    print('whisper $d');
    }).error((e) {
    print('error $e');
    });
    }

    _send() {
    UserData? user = Helpers.readUserData();
    Map<String, dynamic> message = {"driver_mobile": user?.user?.mobile};
    echo.private('session.11111').whisper('drivers.11111', message).error((e) {
    print('error here');
    print('error $e');
    });
    }

    Continue reading...

Compartilhe esta Página