Last active
October 13, 2016 06:30
-
-
Save abhirockzz/4fce7f8fdbd159ab787448325f0e093c to your computer and use it in GitHub Desktop.
Custom ServerApplicationConfig implementation to deploy both Annotated and Programmatic WebSocket endpoints
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
public class HybridEndpointDeploymentStrategy implements ServerApplicationConfig { | |
@Override | |
public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) { | |
//return ALL the auto-detected (scanned) annotated endpoints which the container will deploy | |
return scanned; | |
} | |
@Override | |
public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses) { | |
Set<ServerEndpointConfig> result = new HashSet<>(); | |
for (Class epClass : endpointClasses) { | |
//need to ignore Client endpoint class | |
if (epClass.equals(ChatBot.class)) { | |
ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(epClass, "/chatclub").build(); | |
result.add(sec); | |
} | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment