Created
August 24, 2016 09:11
-
-
Save john77eipe/335bc0e456f42556b6c2ba413b054e0d to your computer and use it in GitHub Desktop.
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 AtomicInteger counter = new AtomicInteger(1); | |
private boolean sendMessage(PrintWriter writer, WeatherToken token) { | |
writer.print("id: "); | |
writer.println(counter.getAndIncrement()); | |
writer.println("event: city"); | |
writer.print("data: "); | |
writer.println(token.getType()+":"+token.getData()); | |
writer.println(); //new line marks an event boundary | |
return writer.checkError(); //checkError() calls writer.flush(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment