Skip to content

Instantly share code, notes, and snippets.

@cemartins
Created March 20, 2014 17:41
Show Gist options
  • Save cemartins/9669556 to your computer and use it in GitHub Desktop.
Save cemartins/9669556 to your computer and use it in GitHub Desktop.
@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();
}
}
}
}
@caohong286
Copy link

caohong286 commented Jul 28, 2018

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment