Skip to content

Instantly share code, notes, and snippets.

@sadah
Created January 31, 2013 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadah/4682195 to your computer and use it in GitHub Desktop.
Save sadah/4682195 to your computer and use it in GitHub Desktop.
Java♡HTML5 Night でライブコーディングしたJavaのWebSocketのサンプルコード。 ライブコーディングなので、いろいろ適当ですが。
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package websocket.sample;
import javax.websocket.Session;
import javax.websocket.WebSocketEndpoint;
import javax.websocket.WebSocketMessage;
/**
*
* @author sada
*/
@WebSocketEndpoint("/echo")
public class NewClass {
@WebSocketMessage
public String echo(String message, Session session){
return session + " " + message;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment