Answers for "pusher connect flutter with laravel"

1

pusher connect flutter with laravel

pusher_websocket_flutter: ^0.1.1
 
 try {
      await Pusher.init(
          "Appid",
          PusherOptions(
            auth: PusherAuth(url, headers: {
              'Content-Type': 'application/json',
              'Authorization': 'Bearer ' + token
            }),
            cluster: "ap2",
            encrypted: true,
          ),
          enableLogging: true);
    } on PlatformException catch (e) {
      print(e.message);
    }

    Pusher.connect(onConnectionStateChange: (x) async {
      print(x.currentState);
    }, onError: (x) {
      debugPrint("Error: ${x.exception}");
    });
    channel = await Pusher.subscribe(
        'private-message-1'}');
    channel.bind('newmessage', (onEvent) {
	print(onEvent.data)

    });
Posted by: Guest on May-26-2021

Code answers related to "pusher connect flutter with laravel"

Browse Popular Code Answers by Language