how to fetch new messages without overloading server in php? - chat

which technology is being used in Google or Facebook chat applications to fetch new messages from server without overloading server with continuous servers queries using Ajax calls ?

Facebook and Gmail might be using Real time messaging protocol for instant messaging.
Please refer this page to read more about RTMP
wikipedia.org/wiki/Real_Time_Messaging_Protocol

Related

Send existing geolocation data from cloud server to Live Objects

I currently have a running instance in Google Cloud which stores geolocation data from an IoT device. I wanted to connect my Google Cloud server to Live Objects so that these geolocation data can be used. Is there a way to connect Google Cloud and Live Objects together, to share data? Or is there a way to send a post request from an external server script (Node.js) to Live Objects without using MQTT? The post request is just a normal HTTP post. The HTTP post will be sent using REST API.
Thanks in advance.
Yes you can push data in Live Objects by using HTTPS REST API
check https://liveobjects.orange-business.com/swagger-ui/index.html#!/Data_management_data_store/addDataMessageUsingPOST
and example here: https://liveobjects.orange-business.com/doc/html/lo_manual.html#STREAMS
cheers

how to get live data from REST API using guzzle

I'm new to whole live data broadcast. I'm creating a website on laravel 5.1, and I need to get live data from a REST API, and after making some changes, broadcast the result to my own users.
I'm using pusher to broadcast data to my clients. and I figured, I should use Guzzle and/or CURL to get data from API. but the part I don't understand is how to get live data from API? Is there an option in guzzle that will keep the connection open continuously,or should I create a job to execute guzzle code every few seconds?
I know we use websockets to create a persistent connection between the server and clients to broadcast live data. but how to create a persistent connection between API server and my server to transfer the data?
Thank you friends in advance, appreciate any help :)
It depends on an API that you are using. If it's an usual REST API, then there are no options to make a "live" catching. Only pull the API periodically.
You API provider might support webhooks, websockets or some other technologies for push model. Depends on a provider, as I said before.

Cloud Messaging or REST API?

I am using the Firebase Cloud Messaging to send message to my app. I am thinking about using is to also send data from my app to my server, but I am not sure if there is any advantage in using that over a classic HTTP REST api.
I am better of sticking with a classic HTTP api to send message from devices to server, or is using a Firebase upstream message better in some ways?
The "official" advantage of an upstream FCM message, at least on Android, would be that no additional network connection is needed, resulting in performance and battery-saving benefits, and possibly easier implementation.
Depending on how you authenticate users I see a potential simplification in the case of FCM, as you may not need a separate authentication mechanism compared to a REST API.

Is it possible to retrieve message history from HipChat via XMPP?

I am building a chat client that talks to HipChat's XMPP API. I would like to retrieve 1:1 message history between the user and other's on his contact list. There is a XMPP protocol for doing this, XEP-0136, but it appears that HipChat does not support it. It is not listed on their HipChat XMPP Documentation, and when I try to make that call the server returns an error saying it's not supported.
Is there any way to do this via HipChat's XMPP API? I know their OAuth API supports it, but I don't want to use that.

How to use Google Cloud Messaging from Google App Engine without consuming limited quotas?

I am developing a messaging app, using Google App Engine (GAE) and Google Cloud Messaging (GCM). GCM has no usage limits, but calling its API from my backend in GAE, uses the URLFetch API, which has a daily limit of 172,800,000 calls. I like thinking big: If I had 200 million users, not all of them would be able to send just one message.
I have tried using Apache HttpClient instead of the GCM provided sender class, but it uses sockets internally, consuming the Google API Sockets instead, which has a daily limit of 663,552,000. My imaginary 200 million users could just send 3 messages each...
So, is there any way to call the GCM API from GAE that don't consume any hard capped quota?
Thanks in advance.