All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.iteaj.iot.client.websocket.WebSocketClientComponentAbstract Maven / Gradle / Ivy

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