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

com.neko233.socket233.impl.websocket.pipeline.WebSocketConfigChannelInitializer Maven / Gradle / Ivy

The newest version!
package com.neko233.socket233.impl.websocket.pipeline;

import com.neko233.socket233.core.NetworkEngine;
import com.neko233.socket233.impl.websocket.handler.HttpUpgradeToWebsocketProtocolHandler;
import com.neko233.socket233.netty.api.AbstractEngineChannelInitializer;
import io.netty.channel.Channel;
import io.netty.handler.codec.http.HttpServerCodec;
import org.jetbrains.annotations.NotNull;

/**
 * @author SolarisNeko
 * Date on 2022-12-16
 */
public class WebSocketConfigChannelInitializer extends AbstractEngineChannelInitializer {

    public WebSocketConfigChannelInitializer(@NotNull NetworkEngine networkEngine) {
        super(networkEngine);
    }

    @Override
    protected void initChannel(Channel channel) throws Exception {
        channel.pipeline()
                .addLast("httpServerCodec", new HttpServerCodec())
                .addLast("httpServerHandler", new HttpUpgradeToWebsocketProtocolHandler(this.getNetworkEngine()))
        ;
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy