Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm trying to understand how web notification(HTML5) is works.
I found some solutions for call user for permissions:notify.js,
currently I am looking for any way to send notifications for subscribed users. I planing to create a backend script in PHP. What kind of data, should I save when user allows notifications receiving, for easy sending notifications?
There are two kinds of web notifications:
on-site push notifications: you can send them only when a user has a page of your website open. You can use the Web Notification API (or notify.js) to display the notification. You also need to fetch the notification from a server: you can use AJAX, long polling, websockets, etc.
off-site push notifications: you can reach a user even when he is not on your website. You need to use the Web Notification API together with the W3C Push API and service workers. In this case you need to collect an endpoint that represents the user device (browser), then store it on a server and then send notifications to it (for example using this PHP library). Otherwise you can use a service like Pushpad (I am the founder) which offers a PHP library.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
We have an app that has separate pwa and standard web site made in CodeIgniter(PHP framework).
Is there a way to send push notifications from a web site version of the app, to the pwa users that never visited the website?
For example when somebody post a comment on a user picture using the web site, is there a way to notify the pwa user?
From the research I've done, its possible to send the notifications from website if user accepts them, but if used that method, user would first have to visit the website on their cell phone and accept the push notifications. That is not very user friendly.
Ideally, the user would just use the pwa, accept the notifications there, and actions on the website would trigger notifications to the pwa-s user cellphone.
No.
Browser based notifications are designed to be opt-in. That policy is enforced by the browser.
Without that our phones would be buzzing 24 hours a day.
You could build a native app that does notifications.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I read all possible information about webhook that I found, but there is no answer about why to use webhooks instead of Https Request which is much easier.
I built API that needs to notify users' server when the certain action happened on my server. Users provide me a URL and I need to send Webhooks or HTTP Post Request to that specific URL.
I can use cron jobs and send HTTP post request when something new happened on the server. Why do I need to use webhooks, if there is a more easy way to do this?
What is the advantage of webhooks over API request? What will be the benefit of using Webhooks over HTTP POST REQUESTS?
Webhooks allow one site to notify another site of something that happened, in real-time (or near-real-time).
As an example, let's say my app integrates with Facebook, and I want to know when a new comment is posted to a Facebook Page.
Without webhooks, I have to regularly check every single post that Page ever made for new comments. If they have a thousand posts, and I check every five minutes, that's twelve thousand API calls every hour... forever.
With webhooks, Facebook tells my server via a POST "hey there was a new comment on post #12345" once, when the comment is created.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a Social Network type Laravel application where users can comment and follow each other, and subscribe a page/user to get notification whenever a new blog/post has been published by the page.
Suppose, 1000+ users has subscribed to get notification for a page. Now, whenever the page publishes a post, I should send notification to all users who has subscribed.
I have a table for notifications like:-
user_id - the user who has subscribed
page_id - the page who published the blog/post
notification - the notification text (same for all users)
Basically, I want to send the notification to all users who has subscribed to the page. In laravel, I can use loop or chunk for all users to add rows to the database. But I want to know what will be the most robust way to send notification to users in laravel. Thanks.
Definitely consider looking into Laravel's Queue for this. It will give a fine tuned control over how many get sent at once, when they get sent and how to handle the case of failure. I use the Queue + Redis for a lot of very similar functionality. https://laravel.com/docs/5.4/queues
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
So I have an app that includes peer to peer chat, which is only between two users at a time. What I am doing now is upon the user typing a new message, it calls a PHP script which inserts the message into a mysql table. then every 5 seconds the code calls a php script which downloads all the messages. So there is a maximum 10 second gap between messages. So my question is if there is a better way to do peer to peer chat.
You can use the server as a matchmaker - use it only to find the other phone. You provide the IP address so that one phone can contact the other phone and initiate a connection. One of the phones act as a chat server.
You can read about sockets programming with Cocoa for example here: http://cocoawithlove.com/2009/07/simple-extensible-http-server-in-cocoa.html
You can check out something like IP Messaging with Twilio.
In the iOS quickstart (https://www.twilio.com/docs/api/ip-messaging/guides/quickstart-ios) you can try it out in Objective-C or Swift.
The server side app there (in PHP) manages identity and access tokens for the application and the simple/example UI you end up with is this:
[Note: I work for Twilio]
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Can you give me an idea on how to implement chat room using PHP and MySQL?
You will probably want to use AJAX or if not that, Javascript with timer to make chat appear instant or with polled updates.
(Chat text data fetched and displayed.) Form frontend fields accepts chat input
Chat input sent to server via form. AJAX waits to receive data to update chat text display.
Server updates a data queue (example - PHP dumps to MySQL). Data sent back to frontend via AJAX wrappers
Repeat
There are lots of tutorials on creating something like this - including a number with AJAX i/o - http://css-tricks.com/chat2/
The best you can do with php and mysql is create a bulletin board kind of system where people add comments to a "channel", then reload the page to update.
In general, I think, it is a bad idea to use PHP for this kind of project. Every client hast to reload the page (mentioned bulletin board e. g.) every few seconds to get informed about updates.
If you want to code in PHP and a little javascript, try Jaxl library Web Chat sample application. Can be worked upon to build a full fledged chat systems. http://github.com/abhinavsingh/JAXL. XMPP protocol is the way today, when it comes to chat client :D