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