-
- All Implemented Interfaces:
-
com.tds.common.websocket.WebSocketEventListener
public class TDSFriendWSService implements WebSocketEventListener处理长连接的连接状态维护及消息处理
-
-
Field Summary
Fields Modifier and Type Field Description private longconnectedTimeprivate longdisconnectTime
-
Method Summary
Modifier and Type Method Description longgetConnectedTime()longgetDisconnectTime()static TDSFriendWSServicegetInstance()voidconnect(String url)建立连接 voiddisconnect()断开长连接,中断对应消息处理线程,清空缓存 voidcheckConnection()检查长连接状态,如果断开,重新连接 voidonOpen()voidonClose(int code, String reason, boolean remote)voidonMessage(String msg)voidonError(Exception e)voidstartHandleMessage()开启线程处理消息 -
-
Method Detail
-
getConnectedTime
long getConnectedTime()
-
getDisconnectTime
long getDisconnectTime()
-
getInstance
static TDSFriendWSService getInstance()
-
disconnect
void disconnect()
断开长连接,中断对应消息处理线程,清空缓存
-
checkConnection
void checkConnection()
检查长连接状态,如果断开,重新连接
-
onOpen
void onOpen()
-
startHandleMessage
void startHandleMessage()
开启线程处理消息
-
-
-
-