Search in sources :

Example 1 with EncoderHandler

use of com.corundumstudio.socketio.handler.EncoderHandler in project netty-socketio by mrniko.

the class SocketIOChannelInitializer method start.

public void start(Configuration configuration, NamespacesHub namespacesHub) {
    this.configuration = configuration;
    ackManager = new AckManager(scheduler);
    JsonSupport jsonSupport = configuration.getJsonSupport();
    PacketEncoder encoder = new PacketEncoder(configuration, jsonSupport);
    PacketDecoder decoder = new PacketDecoder(jsonSupport, ackManager);
    String connectPath = configuration.getContext() + "/";
    boolean isSsl = configuration.getKeyStore() != null;
    if (isSsl) {
        try {
            sslContext = createSSLContext(configuration);
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }
    StoreFactory factory = configuration.getStoreFactory();
    authorizeHandler = new AuthorizeHandler(connectPath, scheduler, configuration, namespacesHub, factory, this, ackManager, clientsBox);
    factory.init(namespacesHub, authorizeHandler, jsonSupport);
    xhrPollingTransport = new PollingTransport(decoder, authorizeHandler, clientsBox);
    webSocketTransport = new WebSocketTransport(isSsl, authorizeHandler, configuration, scheduler, clientsBox);
    PacketListener packetListener = new PacketListener(ackManager, namespacesHub, xhrPollingTransport, scheduler);
    packetHandler = new InPacketHandler(packetListener, decoder, namespacesHub, configuration.getExceptionListener());
    try {
        encoderHandler = new EncoderHandler(configuration, encoder);
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
    wrongUrlHandler = new WrongUrlHandler();
}
Also used : AuthorizeHandler(com.corundumstudio.socketio.handler.AuthorizeHandler) PacketEncoder(com.corundumstudio.socketio.protocol.PacketEncoder) EncoderHandler(com.corundumstudio.socketio.handler.EncoderHandler) PacketDecoder(com.corundumstudio.socketio.protocol.PacketDecoder) StoreFactory(com.corundumstudio.socketio.store.StoreFactory) PacketListener(com.corundumstudio.socketio.handler.PacketListener) InPacketHandler(com.corundumstudio.socketio.handler.InPacketHandler) WrongUrlHandler(com.corundumstudio.socketio.handler.WrongUrlHandler) PollingTransport(com.corundumstudio.socketio.transport.PollingTransport) JsonSupport(com.corundumstudio.socketio.protocol.JsonSupport) AckManager(com.corundumstudio.socketio.ack.AckManager) WebSocketTransport(com.corundumstudio.socketio.transport.WebSocketTransport)

Aggregations

AckManager (com.corundumstudio.socketio.ack.AckManager)1 AuthorizeHandler (com.corundumstudio.socketio.handler.AuthorizeHandler)1 EncoderHandler (com.corundumstudio.socketio.handler.EncoderHandler)1 InPacketHandler (com.corundumstudio.socketio.handler.InPacketHandler)1 PacketListener (com.corundumstudio.socketio.handler.PacketListener)1 WrongUrlHandler (com.corundumstudio.socketio.handler.WrongUrlHandler)1 JsonSupport (com.corundumstudio.socketio.protocol.JsonSupport)1 PacketDecoder (com.corundumstudio.socketio.protocol.PacketDecoder)1 PacketEncoder (com.corundumstudio.socketio.protocol.PacketEncoder)1 StoreFactory (com.corundumstudio.socketio.store.StoreFactory)1 PollingTransport (com.corundumstudio.socketio.transport.PollingTransport)1 WebSocketTransport (com.corundumstudio.socketio.transport.WebSocketTransport)1