public class MsgConnector extends WebSocketClient
uriDEFAULT_PORT, DEFAULT_WSS_PORT| 构造器和说明 |
|---|
MsgConnector(URI serverUri,
Map<String,String> httpHeaders,
AlipayMsgClient alipayMsgClient,
String charset) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
onClose(int code,
String reason,
boolean remote)
Called after the websocket connection has been closed.
|
void |
onError(Exception ex)
Called when errors occurs.
|
void |
onMessage(String message)
Callback for string messages received from the remote host
|
void |
onOpen(ServerHandshake handshakedata)
Called after an opening handshake has been performed and the given websocket is ready to be written on.
|
close, close, close, closeBlocking, closeConnection, connect, connectBlocking, connectBlocking, getAttachment, getConnection, getConnections, getDraft, getLocalSocketAddress, getLocalSocketAddress, getReadyState, getRemoteSocketAddress, getRemoteSocketAddress, getResourceDescriptor, getSocket, getURI, hasBufferedData, isClosed, isClosing, isFlushAndClose, isOpen, onCloseInitiated, onClosing, onMessage, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketOpen, onWriteDemand, reconnect, reconnectBlocking, run, send, send, send, sendFragmentedFrame, sendFrame, sendFrame, sendPing, setAttachment, setProxy, setSocketgetConnectionLostTimeout, isReuseAddr, isTcpNoDelay, setConnectionLostTimeout, setReuseAddr, setTcpNoDelay, startConnectionLostTimer, stopConnectionLostTimeronWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeReceivedAsServer, onWebsocketHandshakeSentAsClient, onWebsocketPing, onWebsocketPongpublic void onOpen(ServerHandshake handshakedata)
WebSocketClientonOpen 在类中 WebSocketClienthandshakedata - The handshake of the websocket instancepublic void onMessage(String message)
WebSocketClientonMessage 在类中 WebSocketClientmessage - The UTF-8 decoded message that was received.WebSocketClient.onMessage(ByteBuffer)public void onClose(int code,
String reason,
boolean remote)
WebSocketClientonClose 在类中 WebSocketClientcode - The codes can be looked up here: CloseFramereason - Additional information stringremote - Returns whether or not the closing of the connection was initiated by the remote host.public void onError(Exception ex)
WebSocketClientWebSocketClient.onClose(int, String, boolean) will be called
additionally.onError 在类中 WebSocketClientex - The exception causing this errorCopyright © 2023. All rights reserved.