pi icon indicating copy to clipboard operation
pi copied to clipboard

Finish notification system

Open voltan opened this issue 8 years ago • 19 comments

voltan avatar Dec 27 '16 12:12 voltan

On my tests new notification service work well , need update all modules to use new service

voltan avatar Feb 05 '17 16:02 voltan

How do you see it work? I mean on use side. How to register to notification on content? Like xoops way? crontab or not?

Marc-pi avatar Feb 05 '17 16:02 Marc-pi

we talked about it before , at this moment notification just send mail / message / sms , I just add service than for many actions notification module not needed to install

voltan avatar Feb 05 '17 16:02 voltan

Yes, i know, you made the core side, but about yet side? Notification on new content / user register on notification per module, category, new content, edited content??

Marc-pi avatar Feb 05 '17 16:02 Marc-pi

No , It just do current notification module job, than for send mail and message , install notification module not required

at this moment we don't have any solution for send notification like this , its really useful ? if needed we can make it on notification on next versions, please open issues for it

voltan avatar Feb 05 '17 17:02 voltan

Yes, I know what a service is :-) Notification on comments are highly needed (notif me on thread i commented in) We need also to sync with Apps.

Marc-pi avatar Feb 05 '17 17:02 Marc-pi

@voltan what about the notification module ? we can delete/remove it?

if needed we can make it on notification on next versions, please open issues for it

already opened there https://github.com/pi-engine/guide/issues/740

Marc-pi avatar Feb 06 '17 14:02 Marc-pi

Please still wait for it , some other checks needed

voltan avatar Feb 07 '17 12:02 voltan

We will fix regression (wrong message send, recession on guide)

Marc-pi avatar Feb 07 '17 12:02 Marc-pi

@voltan well, we will rollback your change in guide module

we have an architecture/design stake there, we have to think a little bit further on about this notification needs :

  • either make notification module a core module (like page, widget, etc.)
  • either merge it into system (but makes system too heavy)

Notification module is currently able to :

  • send SMS
  • manage cron
  • send ping to message module (notification tab)
  • send mail (warn user about the notification he received)

Only message module is visible from end user : there are 2 tables (message/notif) in Message module To sync notification with Android/iOS apps, we'll need to sync notif table of message module

@taiwen your thoughts on this?

Marc-pi avatar Feb 07 '17 13:02 Marc-pi

Hello

I see this problem : https://github.com/pi-engine/guide/issues/888 , I will fix it tomorrow , My plan is : 1- have notification service to send mail and if message module install send message, without need any external module 2- corn should part of core service , at this moment I add function on notification but I think about move it as new service 3- send sms can be part of notification module , but should call from notification service , this part need update 4- for send mobile app notification we need use google service or users run push server ( not easy and expensive ) , than we need think more about this , but it should e part of notification module , and call from notification service

than all notification features should call from notification service , if notification module installed extra services can work and if not installed minimal service work

voltan avatar Feb 08 '17 06:02 voltan

I Add todo list for this service

voltan avatar Feb 08 '17 09:02 voltan

for send notification on mobile apps , I want use it : https://firebase.google.com and this php example http://sab99r.com/blog/firebase-cloud-messaging-fcm-php-backend/

voltan avatar Feb 11 '17 06:02 voltan

Yes, seems to be the right platform to use. I will discuss with apps Dev on Monday, but I've not doubt.google cloud messaging have been repackaged in firebase platform. Good shot.

Marc-pi avatar Feb 11 '17 15:02 Marc-pi

I try finish it this week , need build test app too

voltan avatar Feb 12 '17 08:02 voltan

Why not cafeyab?

Marc-pi avatar Feb 12 '17 08:02 Marc-pi

I have plan to rewrite cafeyab app ( full online ) but before that and for test , I see some test code available , I can work by test codes just replace some field needed , cafeyab need to many change I think

voltan avatar Feb 12 '17 09:02 voltan

example code :

        $url = 'https://fcm.googleapis.com/fcm/send';
        $serverKey = 'MY_KEY';
        $data = array(
            'id' => 123,
            'title' => 'my title',
            'body' => 'my body',
        );

        $fields = array();
        $fields['data'] = $data;
        $fields['priority'] = 'high';
        $fields['to'] = '/topics/TOPIC_NAME';

        $config = array(
            'adapter'   => 'Zend\Http\Client\Adapter\Curl',
        );

        $client = new \Zend\Http\Client($url, $config);
        $headers = $client->getRequest()->getHeaders();
        $headers->addHeaderLine('Authorization', 'key='.$serverKey);
        $client->setMethod('POST');
        $client->setEncType('application/json');
        $client->setRawBody(json_encode($fields));
        $client->setHeaders($headers);
        $response = $client->send();

        if ($response->isSuccess()) {
            echo "Work";
        }else{
            echo "Not work";
        }

voltan avatar Feb 12 '17 13:02 voltan

Firebase Cloud Message added on notification service , I waiting for finish test, some other options like color and sound can be add after finish tests

voltan avatar Feb 14 '17 12:02 voltan