I'm using mobilefirst platform 8.0 to develop my application, i'm handling back-end side, i have a question:
a client got an event like some news update, and when client hit the
button it want another clients will be get notification about. How to
do it ?
can I use adapter to send events from a client to another clients ?
No - you can't send push notifications directly from one mobile device to another...
I might recommend that you build it this way:
Mobile user 1 calls an adapter function that updates or inserts a row to a database table in the backend;
A server process detects that a new row has been inserted (maybe with a database trigger or some polling component), and calls the MFP server-side API to send a push notification for a specific tag;
All the mobile clients that have subscribed to that tag will get the notification;
-Paul Horan-
IBM
Related
I'm trying to make it a notification. What I have in mind right now is a notification system similar to that of Skype.if any person can be a create a new event in application that time show notification in the header.
Any help/advice/answer would be greatly appreciated.
You are going to need a model for your notifications and subscribe all your users to a websocket connection. When they visit the site any type of notification gets broadcasted to all users that are connected to the websocket at that moment. If you like, you can send also an email after the notification was created.
Depending on the version of Rails you are using you will have to use either Faye websockets (https://faye.jcoglan.com/) for 4.X or use ActionCable (websocket) in Rails 5 (http://edgeguides.rubyonrails.org/action_cable_overview.html).
Read as much as you can about how to use websockets and how the connection works. It can be a bit tricky to understand.
If you are willing to use a service, you can use Pusher. They have a free tier and then it starts at around $49 a month depending on the number of connections and amount of messages (notifications) you want to broadcast. (https://pusher.com/)
I'm new to serviceworkers and I wonder how could I connect my serviceworker to my asp.net application. My js client already is communicated with a service worker and it's able to show notifications.
However, I've seen that some webs (e.g facebook) send notifications even the browser's tab ins't opened (not inactive, not opened). I use signalR to communicate my app with the server. Would it be possible to communicate the serviceworker with the server? It would require to add signalR code to the serviceworker if I'm not wrong, but I don't think it's possible. I've seen that google has another way of communication, Google Cloud Communication
I can't use that, so any ideas of how could I solve this problem?
To make use of offline notifications (i.e., your browser is open but your page isn't), the browser itself needs to know about a messaging service that it can respond to, and which would let it know to wake up your service worker and give it a notification. These services are hard-coded into the browser. In Chrome's case, the service is GCM. And I believe Firefox is rolling out something of its own. You cannot wake up your service worker yourself from your server without going through one of these messaging services.
Remember that generally your service worker is asleep. The browser only wakes it up in response to specific events, and, if your pages are closed, there is no way to trigger a service worker event from your server, unless the browser provides a messaging service such as GCM.
I am working on an application which GET and POST information to a server. I am doing so using AFNetworking framework. My aim is to push a notification to a client whenever someone posts new info to the server. Eg: a new grade is published, the student who's grade was published must receive a notification on his iDevice.
Although I am not familiar with how Apple Push Notification works, from what I read I concluded that I need to add server side code in order to trigger a notification.
Note that I don't have access to the server. Service is provided by Fedena.
Any suggestions or hints from where to start?
APNS needs a server in order to work. The usual flow goes like this:
The iOS Application asks user to enable push notifications
Upon access granted, a device token is generated and then must be sent to the server.
Your server must be setup with the proper APNS certificates generated from the Apple Developer site
Then in your server's, when a new post is created, you need to add some logic where you load all the APNS token you've received already and then send the notification to the devices.
This is a very simple flow description but I guess you understood that you need to have access to the server to be able to do what you are trying to achieve.
Some third parties exists to handle push notifications (like Urban Airship), but those push notifications are usually pushed manually from a person, and not triggered from a server event
I recommend that you can use secondary server of your own as intermediate and use it as infrastructure back bone.You can use SignalR library. Use secondary server as to create connection between two devises. One client will push events and another client will listen to events.
Here is the link to the signalR library code written in IOS.
I am currently using these library. What you can do is start hub and connection using these library.
This library allows invoking method on server. Something like this.
[_hub invoke:#"MehtodName" withArgs:params];
What i would do is to create event registry on server. So one client can listen to event on server and other can push events or vice versa.
So your student device can invoke method "subscribe to events" and server will add it into the registry list. You can create secondary service "Publish Events". Grade publisher can publish via calling this method. Here publish events will look up registry and find interested clients and call desired method on client.
Read more about signalr through this site.
Benefit of using Signalr Over APNS.
Cost Effective. As this will save you money which you might have to pay to Apple for pushing notification.
Can Easily make it cross plateform in future. Just have to impletement similar library in Android/Windows.
Quicker as the data does not travel to apple server from your server.
Worst case you can fallback to apns any day, just put push notification code in any of your secondary server methods.
I have done battery and performance testing as well and works perfectly fine.
If you wanna know, here how it handles connection which is very reliable.
SRAutoTransport chooses the best supported transport for both client
and server. This achieved by falling back to less performant
transports. The default transport fallback is:
SRWebSocketTransport
SRServerSentEventsTransport
SRLongPollingTransport
Let me know if you have anyother question. i am currently doing similar work, might be able to help you with your issue.
Now i'm try to developing android and multi client live chat application usin signalr. But i got a problem with signalr connection state. One thing is I don't know how to keep connection state between two android activities. Second is, I don't know how to keep signalr connection state in android. I tried to disconnect signalr connection state when android activity destroy, that's is ok but i got problem when user clean recent application from OS my android client is try to connect new connection oncreate. That's why i want to know how to keep Signalr connection state between android two activity and how to keep signalr connection state.
Another thing is should i use signalr for android instant messaging application. Because i want to create instant messaging application using signalr.
Thanks.
If I have a app in which the user can set remainders for when there is a new article in a blog. And we can find out if there is a new article in the blog by sending a api request. How should I make the app to continuously send requests to the api. Is there an other way to do this or should we just keep sending requests to api continuously. And if so in how much time interval should we send it.
Thanks
In this case delegating the check for updates to some sort of server side would be ideal. The server side logic could send push notifications to your clients.