GCM (Google Cloud Messaging) Bulk with Linux - google-cloud-messaging

Does any one have idea about the best way(implantation) to send Bulk Google Cloud Messaging on a Linux server. (Personally I like non-java implementation) Any help, link or suggession appreciated.
Edit
I didn't try any method for bulk messaging. I know there is a php implementation for GCM too, But I like to know what should I consider before go for an implementation. Like, How to handle failed messages, Is there any limitation on http requests goes to GCM server, etc.

Finally, I found the best answer for my own question. We can send a message to 1000 Google could message recipients using one http request. Sending bulk messaging Shouldn't be that much complicated. Any language or tool are capable of sending appropriate http request to the GCM server is enough.
GCM allows you to attach up to 1,000 recipients to a single message,
letting you easily contact large user bases quickly when appropriate,
while minimizing the work load on your server.

As shown by this example, it seems that the server-side code can even be written in C#. This question also confirms that this approach works. Other people seems to be able to setup standalone Java applications, as shown here.
If you have to setup a Linux server to send GCM push notifications, you can freely chose to use C# or Java at your own discretion.
For what concerns C/C++, however, things are a little more complicated. This question (PHP) shows that GCM notifications can be sent using CURL, so I suspect that a "C/C++" implementation using libCurl could be possible. However you'll have to tweak it yourself, given that it does not seem to be the "standard way" to use GCM.

If you are familiar with PHP than implement it in PHP. Since GCM uses only 2 GETs with HTTPS, you can easily implement it in any language, even batch processing with curl (i am using this for testing). You can find the calls here.
Note that you need a curl.exe which is capable of doing HTTPS. The link from Avio's answer shows you how to do that in PHP, stick to that and do not use C++.

Related

grpc authentication using email

I'm completing a python grpc server function-wise and being ready for deployment. Thusfar I have unsecure communication (pretty much the helloworld example when it comes to security). I thought I could put in place an authentication mechanism for my server in a reasonable amount of time after I observed that there was some documentation on this very topic provided by google. Closer investigation let me to believe otherwise.
The case is simple: Users (fellow colleagues of mine) login to their company mail (gmail) and use the resulting token (JWT, OAuth, OAuth2, I don't care) to gain access to the grpc server I wrote. No one else gets in.
Since googling grpc+authentication has been fruitless so far I believe I'm on the wrong track on how I should approach this kind of problem. So therefore the questions:
Given this use case, should my grpc server have any concern with authentication? If so, are there examples? Or should this be handled by a different system? If so, what system?
I noticed a lot of articles mentioning Envoy+gRPC. Can Envoy help me out here? Is it designed to deal with this?
The gRPC authentication can follow the same approach of a normal HTTP, the only thing you need to have in mind is that the authentication check would be placed in an gRPC interceptor and you will be looking at the metadata to get the creadentials. Unfortunately, I don't have an example to do it with Python but you can search in "how to add gRPC Server interceptors in Python" and then "how to work with gRPC metadata in Python"
Here an example in Golang, maybe it can give you the idea

Is it possible for the server to "listen in" to an audio or video stream?

Using agora.io I'd like to do something like realtime subtitles for video meetings.
Is there a way to have a server get at the data of the video/audio streams?
The server REST api seems very basic just for project management.
I want to get at the streaming audio data, not a local client capture like this demo
Perhaps I could use something like the cloud proxy although I would need to "T Pipe" the data, and I assume the data would be encrypted, not sure if the keys used are something I can get access to.
It also seems like the web client has browser dependencies; perhaps I could run that on a headless/chrome node server, but that seems like a hack and very resource intensive.
Any other suggestions on places I can look for APIs?
Also interested in other webrtc APIs and provider alternatives. Maybe Twilio has some APIs for this.
We provide Linux SDK on a case by case basis which you can deploy headless in your server. This SDK itself will act as a client that joins the channel and receives the video streams in the channel.
The SDK is written in c++ and is not public. you can request access by opening a support ticket at https://agora-ticket.agora.io/

want to understand whatsapp work flow and architecture

I have some questions like how whatsapp server is working, though I read in internet, I want to understand much. And what is XMPP? how it is working, How can I send data through XMPP. how can I integrate XMPP with application, can anyone pls explain?
WhatsApp under the hood?
There are rumors WhatsApp uses a customized version of XMPP. Sources are closed so we can only guess.
Understanding XMPP will however give you all the tools to create your own WhatsApp clone.
What is XMPP?
According to Wikipedia (which hosts further references):
Extensible Messaging and Presence Protocol (XMPP) is a communications protocol for message-oriented middleware based on XML (Extensible Markup Language).
Which is to say that XMPP is an xml based convention for exchanging messages between parties. It's best known implementation is Ejabberd chat server.
XMPP can however be used for other things, among them the web of things.
How to send messages?
Assuming you want to create a chat application, you will need:
An Ejjaberd server up and running.
An appropriate xmpp SDK for you language/framework. Example: Smack for Java or agsXMPP for C#.
A good kick-starting tutorial about how xmpp works can he found here: part one and part two.
There is also the RFC which contains the most comprehensive documentation out there.

What online REST API workbenches are available?

When creating a site/script to be on the client end of a RESTful API, what tools are available to create a "workbench" to explore the API, examining headers and responses while working through the design? Preferably one(s) that allow you to enter a custom endpoint, and create sample requests to see the responses. I recall seeing one nice workbench before, but its name has escaped me.
Re-found the one I remembered: The Apigee Console is a great interface for playing around with an existing API or building your own.
Mashery's I/O Docs is an open source workbench that you can deploy yourself on a Node.js server with Redis for storage.
If you have the wadl file of the ReST Services, you can load it in SOAP UI and use it.
EditedAnother much simpler tool Rest Client

Real-time notification using Python

First there is TornadoWeb, it's async and non-blocking, and on the other side: there is Dojo. If I use tornado, how can I communicate with dojo?
And the other problem, if I use a WSGI solution like Flask, can I make a "notification" with them? Or dojo must have an "open connection" to speak with the server, which is not done using WSGI? mean; Apache or CherryPy will not work with Dojo?
And if WSGI can't speak with Dojo, what about using Atom or Feeds to program notifications under WSGI?
NB: the notification will be devided on two: notification about products for all users, and notification about specific users; it will use sessions...
And last question, what about WebSockets and HTML5? the server must be compatible to use this option with the browser?
I'm not sure why Dojo seems to be the problem in the communication.
Dojo provides you with AJAX wrappers which you can use for almost real-time notifications in a web app with little load by making an AJAX request each 1-5 seconds.
If the app will have a lot of users, frequent AJAX requests can cause too much overhead quickly. Fortunately, you don't have to use Dojo to communicate with the server. You could have a look at Socket.IO and, if you want to stick to Python on the server-side, gevent-socketio. It uses the best technology available in the web browser (WebSockets, Flash sockets, comet) to provide real-time communication.
There is also dojox.socket but I think it's less robust (and far less popular).
You should remember, however, that by using any kind of persistent connection (be it WebSockets, Socket.IO or dojox.socket) you need an asynchronous server able to maintain many simultaneous connections.
The solution you choose should depend on the web app itself and its user base.