扑 Laravel 回声
Flutter Laravel Echo
我是 Flutter Dev 的新手,我想使用 laravel 应用程序将推送器连接到订阅事件的 Flutter app.When,Flutter 绑定 Event.I 意识到该应用程序是无法connect.I收到http异常,不知道具体是哪种异常。
PusherOptions options = PusherOptions(
host: 'http://www.api.dassam.net',
port: 80,
encrypted: false,
activityTimeout: 1200000
);
FlutterPusher pusher =
FlutterPusher('XXXXXX', options, enableLogging: true,
onConnectionStateChange: (ConnectionStateChange x) async {
print(x.currentState);
},onError: (ConnectionError y)=>{
print(y.exception)
});
Echo echo = new Echo({
'broadcaster': 'pusher',
'client': pusher,
"useTLS": false,
});
echo.channel('public').listen('EssaiEvent', (e) {
print('BIEN REUSSI
});
我发现 solution.I 将主机“http://dassam.net”更改为 pusher wshost,它正在运行。
PusherOptions options = PusherOptions(
host: 'ws-ap2.pusher.com',
port: 80,
encrypted: false,
cluster: "ap2",
activityTimeout: 120000);
FlutterPusher pusher = FlutterPusher("XXXXXXXXXXXXXXXX", options,
enableLogging: true,
onConnectionStateChange: (ConnectionStateChange x) async {
print(x.currentState);
},
onError: (ConnectionError y) => {print(y.message)});
Echo echo = new Echo({
'broadcaster': 'pusher',
'client': pusher,
});
echo.channel('public').listen('EssaiEvent', (e) {
print(
'BIEN REUSSI')
});
我是 Flutter Dev 的新手,我想使用 laravel 应用程序将推送器连接到订阅事件的 Flutter app.When,Flutter 绑定 Event.I 意识到该应用程序是无法connect.I收到http异常,不知道具体是哪种异常。
PusherOptions options = PusherOptions(
host: 'http://www.api.dassam.net',
port: 80,
encrypted: false,
activityTimeout: 1200000
);
FlutterPusher pusher =
FlutterPusher('XXXXXX', options, enableLogging: true,
onConnectionStateChange: (ConnectionStateChange x) async {
print(x.currentState);
},onError: (ConnectionError y)=>{
print(y.exception)
});
Echo echo = new Echo({
'broadcaster': 'pusher',
'client': pusher,
"useTLS": false,
});
echo.channel('public').listen('EssaiEvent', (e) {
print('BIEN REUSSI
});
我发现 solution.I 将主机“http://dassam.net”更改为 pusher wshost,它正在运行。
PusherOptions options = PusherOptions(
host: 'ws-ap2.pusher.com',
port: 80,
encrypted: false,
cluster: "ap2",
activityTimeout: 120000);
FlutterPusher pusher = FlutterPusher("XXXXXXXXXXXXXXXX", options,
enableLogging: true,
onConnectionStateChange: (ConnectionStateChange x) async {
print(x.currentState);
},
onError: (ConnectionError y) => {print(y.message)});
Echo echo = new Echo({
'broadcaster': 'pusher',
'client': pusher,
});
echo.channel('public').listen('EssaiEvent', (e) {
print(
'BIEN REUSSI')
});