• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Push Notification for Web Application.

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Guys,

I have a situation here. I am developing a chat functionality which I will be integrating in the existing web application.
The chat functionality will be used by mobile as well so I am planning to use WebSockets. Is it a good idea to use WebSockets for the same?

I am wondering if there is any easier way for web push notifications using java?
I mean if the chat window is minimized or in the background then a notification will be displayed. Just like Facebook.

Please help me with this.

Thanks in advance.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think it's a good idea to keep sockets open for extended periods of time on a mobile device. It may not even be possible, depending on the number of clients you expect, and the number servers to handle the load.

Is the mobile client a web site or an app?
 
Aashish Sawant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,

Thanks for getting back so quickly.
The mobile client is an app.

Thanks.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then why not use the platform's built-in push notifications like CGM for Android?
 
Aashish Sawant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right. We will be using the built-in push notifications for mobile.
I want to know as to how I can use push notification functionality on the web chat functionality?

Any hint or any example would be much appreciated.

Thanks.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the Android developer site has tutorials and example about GCM in general (and I'm sure Apple's iOS dev site has something similar about the API).

You would send a notification to the device whenever a new message is waiting on the server for the user, so that the app would know it should connect and retrieve it (or them - after sending a notification you would not send more if more messages came in until the app collected the messages; only then would you send the next notification when the next message arrives). These notifications would not be displayed to the user, they would only serve to notify the app to go out and retrieve them. Alternatively, you could implement it so that they are NOT retrieved automatically, only once the user opens the application (after seeing a notification that there are new messages waiting).
 
Aashish Sawant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,

What you said is perfectly fine for mobile push notifications.
I am looking for options towards showing notifications onto a java web application just like what facebook does.

Thanks.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That would be a perfect use case for SSE (server sent events), if you don't need to support IE: http://caniuse.com/#feat=eventsource
 
Aashish Sawant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf,

SSE looks awesome. Is there any way by which we can make it work on IE? We are targeting especially IE 8 and above and Chrome.

One more help. Can you give me some idea on how we can secure the chatting web application?

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please start a new topic for the security question in an appropriate forum ;we like to keep discussions to just one topic.
 
Aashish Sawant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure.
 
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic