Created
March 20, 2014 17:41
-
-
Save cemartins/9669556 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
@Component | |
public class MyEndpoint extends Endpoint { | |
@Autowired | |
MyService myService; | |
@Override | |
public void onOpen(Session session, EndpointConfig config) { | |
session.addMessageHandler(new MyMessageHandler(session)); | |
} | |
class MyMessageHandler implements MessageHandler.Whole<String> { | |
final Session session; | |
public MyMessageHandler(Session session) { | |
this.session = session; | |
} | |
@Override | |
public void onMessage(String message) { | |
try { | |
String greeting = myService.getGreeting(); | |
session.getBasicRemote().sendText(greeting + ", got your message (" + message + "). Thanks ! (session: " + session.getId() + ")"); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sir,what can i do for this
[ERROR] Failed to execute goal org.codehaus.mojo:webstart-maven-plugin:1.0-beta-7:jnlp-download-servlet (default) on project websocket-server: Could not obtain key store location at D:\Temp\websocket-test-master${keystore.dir}${keystore.file} -> [Help 1]