Created
October 14, 2016 11:36
-
-
Save abhirockzz/1efbcd63ba93c77de94b9af46a2806ad to your computer and use it in GitHub Desktop.
Annotated WebSocket Server Endpoint example
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
//annotated server endpoint with all its configuration elements | |
@ServerEnpdoint( | |
value = "/chat/", | |
configurator = ChatEndpointConfigurator.class, | |
decoders = JSONToChatObjectDecoder.class, | |
encoders = ChatObjectToJSONEncoder.class, | |
subprotocols = {"chat"} | |
) | |
public class ChatServer { | |
//server endpoint configuration in action | |
@OnOpen | |
public void onOpenCallback(Session session, | |
EndpointConfig epConfig) //injected by the WebSocket runtime | |
{ | |
ServerEndpointConfig serverConfig = (ServerEndpointConfig) epConfig; | |
Map<String, Object> globalPropertiesMap = serverConfig.getUserProperties(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment