wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.22k stars 295 forks source link

Android Client : Create PushStream Class #141

Closed seshuvinay closed 10 years ago

seshuvinay commented 10 years ago

Following code in Javascript is used for browser to connect to a push stream channel and receive messages. So How to implement the same in Android? What should PushStream Client consist of?

var pushstream = new PushStream({ host: "www.mydomain.in", port: window.location.port, modes: "longpolling", secondsAgo:3600
});

try {
pushstream.addChannel('channel'); pushstream.connect(); } catch(e) {};

pushstream.onmessage = function(eventMessage) { if (eventMessage != '') { var values = jQuery.parseJSON(eventMessage); } }

wandenberg commented 10 years ago

By Android, do you mean using java? If yes, you have to implement the client by yourself. Do a GET on subscriber location and handle the proper headers. Take a look on curl commands at docs as reference.

seshuvinay commented 10 years ago

Yes I meant Java. Do you have any working example?

wandenberg commented 10 years ago

Take a look on this code as example https://github.com/wandenberg/nginx-push-stream-module/issues/97#issuecomment-31619692

seshuvinay commented 10 years ago

Thank you! That works like a GEM :) I just had to change my URL and it worked.