在我的 flutter 应用程序中使用 Laravel echo 聊天
chat using Laravel echo in my flutter app
我正在使用 laravel_echo 0.2.2
和推送器进行聊天。
它在调试模式下工作得很好,但在发布模式下它不起作用。
我的 echo 配置是:
echo = new Echo({
'broadcaster': 'pusher',
'client': pusherClient,
"wsHost": 'api.salatkksa.com',
"httpHost": 'api.salatkksa.com',
"wsPort": 6001,
'auth': {
"headers": {'Authorization': 'Bearer $token'}
},
'authEndpoint': 'http://api.salatkksa.com/api/broadcasting/auth',
"disableStats": true,
"forceTLS": false,
"enabledTransports": ['ws', 'wss']
});
和我的推送器配置:
PusherOptions options = PusherOptions(
host: 'api.salatkksa.com',
port: 6001,
encrypted: false,
auth: PusherAuth('http://api.salatkksa.com/api/broadcasting/auth',
headers: {'Authorization': 'Bearer $token'}));
pusherClient = FlutterPusher(
"468adb0d5808c1",
options,
enableLogging: true,
);
我刚刚尝试将其添加到 application
标签内的 androidmanafist.xml
中:
android:usesCleartextTraffic="true"
所以如果我添加 SSL 证书并使用加密消息,它是否有效?
我通过R8或者proguard开启代码混淆解决,添加如下规则:
在android/app/build.gradle:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
如果您没有 proguard-rules.pro
在此路径中创建一个 android/app/proguard-rules.pro
并添加以下内容:
-keep class com.github.heywhy.flutter_pusher.** { *; }
我正在使用 laravel_echo 0.2.2
和推送器进行聊天。
它在调试模式下工作得很好,但在发布模式下它不起作用。
我的 echo 配置是:
echo = new Echo({
'broadcaster': 'pusher',
'client': pusherClient,
"wsHost": 'api.salatkksa.com',
"httpHost": 'api.salatkksa.com',
"wsPort": 6001,
'auth': {
"headers": {'Authorization': 'Bearer $token'}
},
'authEndpoint': 'http://api.salatkksa.com/api/broadcasting/auth',
"disableStats": true,
"forceTLS": false,
"enabledTransports": ['ws', 'wss']
});
和我的推送器配置:
PusherOptions options = PusherOptions(
host: 'api.salatkksa.com',
port: 6001,
encrypted: false,
auth: PusherAuth('http://api.salatkksa.com/api/broadcasting/auth',
headers: {'Authorization': 'Bearer $token'}));
pusherClient = FlutterPusher(
"468adb0d5808c1",
options,
enableLogging: true,
);
我刚刚尝试将其添加到 application
标签内的 androidmanafist.xml
中:
android:usesCleartextTraffic="true"
所以如果我添加 SSL 证书并使用加密消息,它是否有效?
我通过R8或者proguard开启代码混淆解决,添加如下规则:
在android/app/build.gradle:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
如果您没有 proguard-rules.pro
在此路径中创建一个 android/app/proguard-rules.pro
并添加以下内容:
-keep class com.github.heywhy.flutter_pusher.** { *; }