Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best solution for Java HTTP push (messaging) [closed]

We want to push data from a server to clients but can only use HTTP (port 80). What is the best solution for messaging? One idea is Comet. Are there other ideas or frameworks which offer lets say JMS over HTTP. (Yes, ActiveMQ supports it too, but waggly IMHO. And JXTA supports it too but the configuration is complicated. Something simple is preferred.)

like image 370
crusam Avatar asked Nov 13 '09 09:11

crusam


2 Answers

The simplest solution for many, many reasons is to use a Comet based approach (like you mention). This means the clients (to whom you want to "push" messages) open long-lived HTTP connections. Those connections stay open until they time out or you send the client a message. As soon as either happens the client opens a new connection.

Directly connecting to clients could be problematic for many reasons: they could be behind firewalls that disallow that, they could be behind proxies and so on.

Unless your clients are real servers (in which case you're really the client), have them contact you and send a response to mimic push.

like image 99
cletus Avatar answered Oct 02 '22 12:10

cletus


Atmosphere and DWR are both open source frameworks that can make Comet easy in Java.

like image 43
Jason Gritman Avatar answered Oct 02 '22 14:10

Jason Gritman