Push notification for web application From one module to other module - php

i have integrated the notification system for web to android and Apple.
but now i have to integrate the notification system for web application part .
For ex.
currently i am working on restaurant project.
Now When customer Order From his / her mobile application on that time i have to show his/her order in Kitchen department . for that i have to Run ajax From kitchen department module to check that customer is ordered anything.
but the problem is when we run ajax every single minute then it will affect the server. because most of the server are not compatible ( for handling so many ajax request. ).
so i thought can we integrate the concept as same as push notification service for android and ios.
or anything else (different concept) for this one. please suggest a new idea.
i thought many option but at last time it will reach to the solution ajax request

Related

PHP - multi-thread jobs working with Google Cloud API

I created a Saas that collect orders from different websites for companies,
the websites are kind of "publishers" that provide the company orders every day.
I don't have an API so I'm scraping HTML from those websites by using the username and password that the company provides me.
After importing and saving the orders in my database, I'm sending them to the company's printer using Google cloud print API and the company working on the order in real-time.
After the order has been sent to print, I'm sending a post request to the website that basically clicking on a button that says "I got the order and I'm working on it", kind of accepting/approving the order.
the company has a UI that shows them a table of today's orders, for each order, they can see that the order has been approved and sent to the printer by google cloud print and they assume that the order was really printed.
So far, so good, but I have a big issue.
sometimes google cloud print doesn't recognize the printer and the company has to restart the computer that is connected to the printer, the issue is that my UI shows the user that the order has already been printed and also approving the order on the original website so the clients got an approvment that the company is working on the order right now.
google cloud print API provides me the option to check the status of the print but it takes about 6 seconds and maybe the status is "in progress" so it will take me more than 6 seconds for 1 order to get the status I wish for - "done".
right now I have a 2 cron jobs that run every minute,
the first is importing new orders and second sending new orders to print.
when I send an order to print it takes about 4 seconds, so i can send only up to 15 orders per minute, as I said the companies are working in real-time so I cant have any delay from the moment that the order appears in one of the websites to the moment it comes out the printer
I wish that i worked like that:
step 1:
import the order
step 2:
send it to the printer
step 3:
check the status
step 4:
approve the order on the website after I got a "done" status.
I think that my biggest issue is that it's not working with multi-threads
I'm looking for the best way to manage and work with multi-thread jobs in PHP.

Invitation system (push) for web app

I am creating an web app and a user can start a game with multiple players (your friends). This game is played on 1 device. Is it possible that all invited players get a notification on their device where they can accept or decline the invitation ?
So in steps
Player 1 creates a game and invites player 2 and 3
Player 2 receives a notification on his mobile device and presses accept, he is added as player of that game
Player 3 doesn't have a device and enters his PIN to accept his participation.
The step that I want to have is step2.
I have read about OneSignal who can send push notifications to specific users, but I could not find if you can send a response back (accept or decline). Or is there an other way (without to have a native app).
your question is understood but at this moment a little too broad. But. I will try to answer in concept also :)
Now...you said you already know how to send target specific notification with OneSignal.
What you need to do from now one it cloud be like this:
Attach a link or click or action to that invite. Or when such invite
arrived open a particular view in the app/web/application that you are developing and revives the link.
Attach the session/game/user/object ID to that link and send the call
to you API (which is based on your server). If you have an API, if you don't you can have a very simple API build to handle only such requests with URL xxxx.com/path/to/api/call/var1/var2/var3/etc
From there you can catch the request and reply or adapt accordingly on your server side.
Maybe this Framework can help you to speed up the API dev in PHP. Lumen can do that trick.
You can follow this tutorial here for a fast API development with it.

How to trigger iOS push notification for individual users using webhook

I have written a web app in PHP which is an MVP for a product I am launching. Uptake is good and I have active users.
I notify users of certain events right now by integrating with Twilio and sending them an SMS when activity happens on their account.
I would like to release an iOS companion app so that I could notify them via native push message as Twilio SMS costs are decreasing the viability of my product and I do not want increase the monthly price.
I have researched various third party tools such as Pusher, Pushover and Onesignal but none of them seem to fit my need, as far as I can tell.
How could I trigger a custom push notification to an iOS user using my iOS companion app? Ideally I would swap out the Twilio api call and insert something else that called the push message.

My web server and Android communication

I have a web page that is a demo for a web shop, which I will implement later. In the web shop you can select an item to buy it. In my demo scenario, I just want to send the info about the cost of the item to my Android upon button click in the web shop.
STEP-BY-STEP explanation:
openWebShop (in Android app you click a button and it calls this method to open URI)
Web Shop opens with items that you can buy.
Select an item from the list
onItemClick send the prize value and name of item selected to the Android device and store it in a String
Close WebShop -> display your App again with a New Intent / Fragment displaying the chosen Item name and Prize tag.
I also want to upload some files to the web shop. There are some questions here on Stack Overflow on how to do that, but for the time being, I won't tackle that problem yet.
QUESTIONS:
Can I use GCM for my idea ?
Do I need to create a Web page apart from Android coding or can you style your web shop inside Android coding? (no experience with web development)
Do I need to implement a onItemSelected inside PHP or is it done somehow else?
SOME INFO I GOT:
What I have learned so far is that I could use HTTP request to download a file from Web Server. I only saw examples on how to download XML files, but I assume that is the same for any file type. But I am not sure whether if this is the best solution for my case. I noticed GCM, but have trouble with PHP, since I have no experience with it - does it have some sort of onClick method ?

Synching PHP backed Admin portal with a Mobile app

How is it possible to let the android application to know each and every change on admin portal by real time.
Our system is a school based application that works on our own tablets. In system there are Teachers, Parents, Students and a super admin. The tablet has daily attendance management, grades, exams, meetings and so many features for a school system, now the same user entities will have all the features mentioned in the Admin portal as well. lets say www.ourtabletapp.com/admin
so we have a need to synchronize every change that occurs in Admin portal to Android application in real time. (Then and there)
Currently we do have one way synchronization as in any changes to mobile app (new records, modify records and etc) eg: adding a new meeting, then updating it and so on. which is done using a REST API we have written, so mobile app will call the API each time to connect with our DB and synchronize.
Question is what are the ways we have to make it two way synchronization? (Admin portal changes should reflect the mobile application immediately.)
Update:
mobile app is located somewhere else in users mobiles. when a record is added or updated, how to send a request from Admin portal to mobile application and update the sql lite database in it?
you can use the same logic that already has been implemented to notified the admin panel when someone update through the mobile app. let's say if anyone update the any student record from the admin panel , you have to update the DB first [ that already done i think ] and than you have to make the call of REST services that send the call to mobile app with the updated data.
let me know if you need any more help on this. you can share your structure for the better answer if needed.

Categories