Skip to content

Instantly share code, notes, and snippets.

@bveliqi
Created December 18, 2013 21:34
Show Gist options
  • Save bveliqi/8030240 to your computer and use it in GitHub Desktop.
Save bveliqi/8030240 to your computer and use it in GitHub Desktop.
Play WebSocket
public static WebSocket<String> pingWs() {
return new WebSocket<String>() {
@Override
public void onReady(In<String> in, Out<String> out) {
in.onMessage(new F.Callback<String>() {
@Override
public void invoke(String s) throws Throwable {
System.out.println(s);
}
});
in.onClose(new F.Callback0() {
@Override
public void invoke() throws Throwable {
System.out.println("Disconnected");
}
});
out.write("Hello");
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment