Created
March 28, 2016 20:16
-
-
Save ricdex/fa9c8c6749f140d75b44 to your computer and use it in GitHub Desktop.
SSEmiter con Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void startClient() throws InterruptedException { | |
EventSource es = new EventSource(URI.create("http://192.168.1.43:8080/helloCount"), new EventSourceHandler() { | |
@Override | |
public void onConnect() { | |
System.out.println("CONNECTED"); | |
} | |
@Override | |
public void onMessage(String event, MessageEvent message) { | |
System.out.println("event = " + event + ", message = " + message); | |
} | |
@Override | |
public void onError(Throwable t) { | |
System.err.println("ERROR"); | |
t.printStackTrace(); | |
} | |
}); | |
es.connect(); | |
new CountDownLatch(1).await(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment