com.iteaj.iot.client.websocket.WebSocketClientComponentAbstract Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iot-client Show documentation
Show all versions of iot-client Show documentation
基于netty的tcp, http, udp等协议的客户端
The newest version!
package com.iteaj.iot.client.websocket;
import com.iteaj.iot.client.MultiClientManager;
import com.iteaj.iot.client.codec.WebSocketClient;
import com.iteaj.iot.client.component.TcpClientComponent;
import com.iteaj.iot.websocket.WebSocketEncoder;
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
public abstract class WebSocketClientComponentAbstract extends TcpClientComponent implements WebSocketClientComponent{
private WebSocketEncoder webSocketEncoder = new WebSocketEncoder(this);
public WebSocketClientComponentAbstract() { }
public WebSocketClientComponentAbstract(WebSocketClientConnectProperties config) {
super(config);
}
public WebSocketClientComponentAbstract(WebSocketClientConnectProperties config, MultiClientManager clientManager) {
super(config, clientManager);
}
@Override
public WebSocketClientHandshaker createClientHandShaker(WebSocketClient client) {
WebSocketClientConnectProperties config = client.getConfig();
WebSocketClientHandshaker handshaker = WebSocketClientHandshakerFactory
.newHandshaker(config.getUri(), config.getVersion(), config.getSubprotocol()
, config.isAllowExtensions(), config.getCustomHeaders(), config.getMaxFramePayloadLength()
, config.isPerformMasking(), config.isAllowMaskMismatch(), config.getForceCloseTimeoutMillis());
return handshaker;
}
public WebSocketEncoder getWebSocketEncoder() {
return webSocketEncoder;
}
public void setWebSocketEncoder(WebSocketEncoder webSocketEncoder) {
this.webSocketEncoder = webSocketEncoder;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy