I have project in which users can upload posts, other users can comment on these posts.
I want to send automatic push notification to the user (who uploaded the post) whenever other users comment on his post.
The project will be running on mobile (Android and IOS)
How can I go about achieving this? what packages I should use?
I came across activitree:push package but adding it to my meteor project always fails with the following errors:
=> Errors while adding packages:
While loading package activitree:push@1.0.0:
error: Command failed: /Users/mzn/.meteor/packages/meteor-tool/.1.10.2.6hsx6.cly95j++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm rebuild --update-binary
…/ext/channel.cc:292:56: error: too few arguments to function call, expected 2, have 1
int try_to_connect = (int)info[0]->Equals(Nan::True());
/Users/mzn/.meteor/packages/meteor-tool/.1.10.2.6hsx6.cly95j++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/include/node/v8.h:2712:3: note: 'Equals' declared here
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
^
/Users/mzn/.meteor/packages/meteor-tool/.1.10.2.6hsx6.cly95j++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/include/node/v8config.h:368:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
1 error generated.
make: *** [Release/obj.target/grpc_node/ext/channel.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit
(/Users/mzn/.meteor/packages/meteor-tool/.1.10.2.6hsx6.cly95j++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.4.0
I am not sure about about the cause of the issue but I am guessing it could be node versioning issue which might cause me to downgrade which I prefer not to do so (if there are other ways to achieve my objective)
so in conclusion, how should I go with developing automatic push notification to particular users when certain events triggered in the application?
I am the curator of activitree:push. The package (repo) is now at version 2.0.7. I am not sure where you install this from but https://atmospherejs.com/activitree/push should add 2.0.7 for you, too. This package is almost up to date (possible 1 month behind the FCM API Node version), ready for Web Push too, provides the know-how for the necessary service worker, you should be covered for all you need.
I see in your log While loading package activitree:push@1.0.0
Thanks @paulishca, I didn’t notice the current version of the package and the version meteor is trying to install,
Whenever I try meteor add activitree:push, meteor tries to install version 1.0.0 and it fails, I had to use meteor add activitree:push@2.0.7 to successfully install the current version without errors.
I have a question if I may, it is my first time trying to implement push notifications and it is quite ambiguous to me,
Does following this tutorial to setup the client and the server with firebase works with activitree:push package?
That is using raix:push, the package on which activitree:push was based 2 years ago. You could follow that tutorial as far as setting up a Firebase project is concerned but otherwise it is using very old versions of very outdated things…
I think the Activitree:push repo has everything documented. Just to make things easy, the github repo contains folders and files in a file structure that would be expected to exist in your project. It is not a Meteor project that you can run.
@paulishca I have followed the documentation and went through the article to get the understanding of the push notifications,
I reach this step
This needs to be available at https://www.your_address.com/firebase-messaging-sw.js
Should I use push services providers such as WebEngage or OneSignal to get my address? or create a router within my project that runs the firebase-messaging-sw.js
Sorry for asking a lot of questions that might be too simple to be asked -_-
When you use activitree:push, you don’t need to call an install of the service worker anywhere in your Meteor project. You would normally do it in startup/client but activitree:push does this already. If you use WebPush you can add the service worker named firebase-messaging-sw.js otherwise you could have sw.js or nothing. You will also need to read about the best practices for asking users to subscribe to web notifications. There are some dos and don’ts there.
I do not recommend third parties for Push services because no provider can ensure confidentiality/privacy. Ideally you would have your own (micro) service running as a owned 3rd party to your project or just integrated in your project (main Node service) as most of us do.
I went through the article on the package repo and it also mentioned the best practices to ask for the permissions to send notifications,
I have confusion here because I have several apps installed on my phone that sends me notification whenever an event is about to take place for example, without me agreeing on anything, as long as the app is installed in my phone, I am continuously receiving their notifications,