public class ClientTextWebSocketHandler extends org.springframework.web.socket.handler.TextWebSocketHandler implements IClientHandler
ClientTextWebSocketHandler receives the incoming web-socket messages.
reads the json, identifies the topic and then sends it to the TopicProcessor| Constructor and Description |
|---|
ClientTextWebSocketHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterConnectionClosed(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.CloseStatus status) |
void |
afterConnectionEstablished(org.springframework.web.socket.WebSocketSession session) |
void |
handleTextMessage(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.TextMessage incomingMessage)
All messages from real-clients are received by this method.
|
void |
handleTransportError(org.springframework.web.socket.WebSocketSession session,
Throwable exception) |
void |
init() |
void |
routeMessage(org.springframework.web.socket.WebSocketSession session,
String textMessage)
routeMessage routes the message based on the payload to appropriate Processors. |
void |
sendToClient(ClientMessageWrapper clientMessageWrapper)
sendToClient sends the message to clients ( real-world clients ). |
void |
sendToClient(org.springframework.web.socket.WebSocketSession session,
ClientMessage clientMessage) |
void |
shutdown() |
handleBinaryMessage@PostConstruct public void init()
@PreDestroy public void shutdown()
public void afterConnectionEstablished(org.springframework.web.socket.WebSocketSession session)
throws Exception
afterConnectionEstablished in interface org.springframework.web.socket.WebSocketHandlerafterConnectionEstablished in class org.springframework.web.socket.handler.AbstractWebSocketHandlerExceptionpublic void handleTransportError(org.springframework.web.socket.WebSocketSession session,
Throwable exception)
throws Exception
handleTransportError in interface org.springframework.web.socket.WebSocketHandlerhandleTransportError in class org.springframework.web.socket.handler.AbstractWebSocketHandlerExceptionpublic void afterConnectionClosed(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.CloseStatus status)
throws Exception
afterConnectionClosed in interface org.springframework.web.socket.WebSocketHandlerafterConnectionClosed in class org.springframework.web.socket.handler.AbstractWebSocketHandlerExceptionpublic void handleTextMessage(org.springframework.web.socket.WebSocketSession session,
org.springframework.web.socket.TextMessage incomingMessage)
handleTextMessage in class org.springframework.web.socket.handler.AbstractWebSocketHandlersession - incomingMessage - public void routeMessage(org.springframework.web.socket.WebSocketSession session,
String textMessage)
routeMessage routes the message based on the payload to appropriate Processors.session - textMessage - public void sendToClient(ClientMessageWrapper clientMessageWrapper)
sendToClient sends the message to clients ( real-world clients ).
It first tries to send through an existing session (connection).
If connection is not found, then sends the message through GCM/APNS.sendToClient in interface IClientHandlerclientMessageWrapper - Message targetted for the clientpublic void sendToClient(org.springframework.web.socket.WebSocketSession session,
ClientMessage clientMessage)
Copyright © 2016 Pivotal Software, Inc.. All rights reserved.