homex-it / pusher-websocket-flutter Goto Github PK
View Code? Open in Web Editor NEWAn unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS
License: MIT License
An unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS
License: MIT License
I am trying to subscribe to a private room, but getting this invalid signature error.
Invalid signature: Expected HMAC SHA256 hex digest of 8910.66062685:private-5eb108e1110adb4c7da27e34, but got 64ea520ef7a27ed2604d36768c514e2ba38fe78273edfba77878b77585bb90fd
I've read this (https://support.pusher.com/hc/en-us/articles/360019306433-I-receive-Invalid-signature-Expected-HMAC-SHA256-error-what-is-that-) article and tried a few changes in the backend but it is not working.
how can i get the socket id
I've just included the plugin following tutorial found on Flutter community website, but just including library in pubspec.jamal file and running the project fails to build. Just to make sure I'm not dealing with some cached issues, I've also tried running "flutter clean" before starting the app on the simulator, but it still fails. Attached you can find logs that debug console outputs. Tried the same thing by opening Xcode and building the app, but issue is the same.
ErrorMessagePusherPlugin.zip
When trying to include version 0.0.7 to the project, I get an error first that SWIFT_VERSION is not specified in the Podfile, after which I open podfile and add version 4.1 as a dependency. Then another error appears, related to umbrella header, I have no idea how to fix:
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET pusher_websocket_flutter OF PROJECT Pods WITH CONFIGURATION Debug ===
While building module 'pusher_websocket_flutter' imported from /Users/aleksandarlugonja/Desktop/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/pusher_websocket_flutter-0.0.7/ios/Classes/PusherPlugin.m:2:
While building module 'PusherSwift' imported from /Users/aleksandarlugonja/Desktop/development/myApp/build/ios/Debug-iphonesimulator/pusher_websocket_flutter/pusher_websocket_flutter.framework/Headers/pusher_websocket_flutter-Swift.h:171:
In file included from :2:
/Users/aleksandarlugonja/Desktop/development/myApp/build/ios/Debug-iphonesimulator/PusherSwift/Swift Compatibility Header/PusherSwift-Swift.h:481:12: warning: parameter 'channelName' not found in the function declaration [-Wdocumentation]
/// \param channelName The name of the channel
^~~~~~~~~~~
/Users/aleksandarlugonja/Desktop/development/myApp/build/ios/Debug-iphonesimulator/PusherSwift/Swift Compatibility Header/PusherSwift-Swift.h:481:12: note: did you mean 'channel'?
/// \param channelName The name of the channel
^~~~~~~~~~~
channel
While building module 'pusher_websocket_flutter' imported from /Users/aleksandarlugonja/Desktop/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/pusher_websocket_flutter-0.0.7/ios/Classes/PusherPlugin.m:2:
While building module 'PusherSwift' imported from /Users/aleksandarlugonja/Desktop/development/myApp/build/ios/Debug-iphonesimulator/pusher_websocket_flutter/pusher_websocket_flutter.framework/Headers/pusher_websocket_flutter-Swift.h:171:
:1:1: warning: umbrella header for module 'PusherSwift' does not include header '/PusherSwift.framework/Headers/PusherSwift-umbrella.h' [-Wincomplete-umbrella]
#import "PusherSwift-umbrella.h"
^
:1:1: warning: umbrella header for module 'PusherSwift' does not include header '/PusherSwift.framework/Headers/PusherSwift-Swift.h' [-Wincomplete-umbrella]
3 warnings generated.
3 warnings generated.
/Users/aleksandarlugonja/Desktop/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/pusher_websocket_flutter-0.0.7/ios/Classes/PusherPlugin.m:4:17: error: definition of 'PusherPlugin' must be imported from module 'pusher_websocket_flutter.PusherPlugin' before it is required
@implementation PusherPlugin
^
In module 'pusher_websocket_flutter' imported from /Users/aleksandarlugonja/Desktop/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/pusher_websocket_flutter-0.0.7/ios/Classes/PusherPlugin.m:2:
/Users/aleksandarlugonja/Desktop/development/myApp/build/ios/Debug-iphonesimulator/pusher_websocket_flutter/pusher_websocket_flutter.framework/Headers/PusherPlugin.h:3:12: note: previous definition is here
@interface PusherPlugin : NSObject
^
3 warnings and 1 error generated.
What am I missing here?
Podfile has platform set to 9.0, and swift version set to 4.1. I've also tried with 4.0, 5.0, and no luck...
Hey guys, first of all I'm glad for this package, using it for a month now.
PusherOptions only takes cluster as a parameter but I need to set host and port.
Can you guys help me to achieve that or add it to the package if you have time to do that?
I've also do some work on it but It gives me connection exception, I'd appreciate some help.
https://github.com/mirkancal/pusher-websocket-flutter
now i wanna use real time data base and send notification to android and ios
pusher-websocket-flutter can do this
pusher_websocket_flutter: ^0.1.1
The code shown below is successfully initialized, connected and subscribed to pusher service but doesn't receive data from the channel.bind method. If I put logs in _initializePusherService and subscribe I can see them, but not from inside channel.bind.
Tested and does not work:
Note: This code works perfectly on any android version and device. (Receiving data)
Reproducible code
import 'dart:async';
import 'package:pusher_websocket_flutter/pusher.dart';
const channelName = "myChannelName";
const eventName = "myEventName";
const clusterName = "myClusterName";
class PusherService {
static final PusherService _instance = PusherService._privateConstructor();
StreamController<List> _streamController = StreamController<List>.broadcast();
Sink get _inEventData => _streamController.sink;
factory PusherService() {
return _instance;
}
PusherService._privateConstructor() {
_initializePusherService();
}
void _initializePusherService() async {
await Pusher.init("pusherUrl", PusherOptions(cluster: clusterName));
Pusher.connect(
onConnectionStateChange: (ConnectionStateChange connectionState) async {
print('PusherService - connection status changed: ' +
connectionState.currentState);
}, onError: (ConnectionError error) {
print('PusherService - error: ' + error.message);
});
}
void subscribe() {
Pusher.subscribe(channelName).then((Channel channel) {
channel.bind(eventName, (Event last) {
print("PusherService - Received new data");
_inEventData.add(last.data);
});
});
}
void unsubscribe() {
print("PusherService - Unsubscribing from this service.");
Pusher.unsubscribe(channelName);
}
}
I am importing this class in main.dart fail and calling it like this
@override
void initState() {
PusherService().subscribe();
}
Here is my flutter doctor -v
We are using both Gson
and basic JSONObject
. We should consolidate the code to use one or the other for all our Json work on Android.
How to triggering events to Pusher server and broadcast to a channel that subscriber subscribes to ?
Based on #15
I am able to receive pusher events when the app is running in background or when the app is open . When i clear the app from background it does not receive events .
Hello, thank you very much for this package.
I am successfully able to subscribe to the public channels and receive events that are sent from the pusher debug console.
The exception is thrown when I am trying to subscribe to private channels.
I have in the backend written in laravel. I'm not a back end developer so I could not debug if the problem is on the back end.
I pass the required auth endpoint and also the request headers to PusherAuth
.
When I try to connect to the pusher cancel and subscribe to a private channel I get this file not found exception which points to the auth endpoint URL as below
D/PusherPlugin( 8418): onCancel args: null
D/PusherPlugin( 8418): init
D/PusherPlugin( 8418): connect
D/PusherPlugin( 8418): subscribe (private)
D/PusherPlugin( 8418): bind (BroadcastNotificationCreated)
I/flutter ( 8418): CONNECTING
I/flutter ( 8418): CONNECTED
D/PusherPlugin( 8418): onError : java.io.FileNotFoundException: https://<my-url>/broadcasting/auth
W/System.err( 8418): com.pusher.client.AuthorizationFailureException: java.io.FileNotFoundException: https://<my-url>/broadcasting/auth
W/System.err( 8418): at com.pusher.client.util.HttpAuthorizer.authorize(HttpAuthorizer.java:146)
W/System.err( 8418): at com.pusher.client.channel.impl.PrivateChannelImpl.getAuthResponse(PrivateChannelImpl.java:127)
W/System.err( 8418): at com.pusher.client.channel.impl.PrivateChannelImpl.toSubscribeMessage(PrivateChannelImpl.java:90)
W/System.err( 8418): at com.pusher.client.channel.impl.ChannelManager$1.run(ChannelManager.java:140)
W/System.err( 8418): at com.pusher.client.util.Factory$1.run(Factory.java:109)
W/System.err( 8418): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/System.err( 8418): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/System.err( 8418): at java.lang.Thread.run(Thread.java:764)
W/System.err( 8418): Caused by: java.io.FileNotFoundException: https://<my-url>/broadcasting/auth
W/System.err( 8418): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:251)
W/System.err( 8418): at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
W/System.err( 8418): at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(Unknown Source:0)
W/System.err( 8418): at com.pusher.client.util.HttpAuthorizer.authorize(HttpAuthorizer.java:128)
W/System.err( 8418): ... 7 more
I/flutter ( 8418): java.io.FileNotFoundException: https://<my-url>/broadcasting/auth
W/OkHttpClient( 8418): A connection to <my-url> was leaked. Did you forget to close a response body?
I cannot add the real URL above in the logs so added .
The laravel code does not have any auth endpoint set, so according to the laravel docs the default is /broadcasting/auth
.
Any help is appreciated.
Hi,
After I run pod install, I get these errors:
[!] A license was specified in podspec pusher_websocket_flutter
but the file does not exist - .../ios/.symlinks/plugins/LICENSE
[!] Unable to read the license file ../../LICENSE
for the spec pusher_websocket_flutter (0.1.1)
[!] Unable to read the license file ../../LICENSE
for the spec pusher_websocket_flutter (0.1.1)
I see the license file but it at .../ios/.symlinks/plugins/pusher_websocket_flutter/LICENSE
Please help!
Thanks, Shilpi
Im currently using raspberry to test the websocket;
Must the Pusher Options host be a domain (ws.pusherapp.com) or can it be local IP address ?
I have a view with a bottomNavigationBar, when I move between each tab, the Pusher connection changes to: DISCONNECTED. I only execute the action of "pusher.connect" in the initState of the view
Just add this 2 in pubspec.yaml
then run the app in iOS
pusher_websocket_flutter: ^0.1.1
connectivity: ^0.4.4+1
When you combine this 2 library your app wont work anymore in iOS.
because of the library "Reachability"
Please give suggestions how to fix this situations
When I remove the connectivity library it will work as expected
Good night to who created this library.
Today I come with a question to you, since I would like to implement push notifications through pusher in my flutter app, I look forward to your response
Unexpected error when starting pusher
try { await Pusher.init(appKey, options); } catch (e) { print("Error in Pusher.init"); print(e.message); }
`
D/PusherPlugin(32719): onCancel args: null
E/MethodChannel#pusher(32719): Failed to handle method call
E/MethodChannel#pusher(32719): java.util.ConcurrentModificationException
E/MethodChannel#pusher(32719): at java.util.HashMap$HashIterator.nextNode(HashMap.java:1441)
E/MethodChannel#pusher(32719): at java.util.HashMap$EntryIterator.next(HashMap.java:1475)
E/MethodChannel#pusher(32719): at java.util.HashMap$EntryIterator.next(HashMap.java:1473)
E/MethodChannel#pusher(32719): at com.pusherwebsocket.pusher.PusherPlugin.init(PusherPlugin.java:114)
E/MethodChannel#pusher(32719): at com.pusherwebsocket.pusher.PusherPlugin.onMethodCall(PusherPlugin.java:83)
E/MethodChannel#pusher(32719): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:230)
E/MethodChannel#pusher(32719): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#pusher(32719): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/MethodChannel#pusher(32719): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#pusher(32719): at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#pusher(32719): at android.os.Looper.loop(Looper.java:165)
E/MethodChannel#pusher(32719): at android.app.ActivityThread.main(ActivityThread.java:6831)
E/MethodChannel#pusher(32719): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#pusher(32719): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
E/MethodChannel#pusher(32719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:927)
`
Hi,
How to broadcast to private channel?
The following code is supposed to works for the initialization of pusher Works in Android and iOS
await Pusher.init( "KEY", PusherOptions(cluster: "-",), enableLogging: true);
With flutter web this initialization code is even unable to initiate, no errors apparently, just the line is never completed and the code gets stopped.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.