Search in sources :

Example 1 with ChannelConnector

use of com.generallycloud.baseio.connector.ChannelConnector in project baseio by generallycloud.

the class ExitExecutable method exec.

@Override
public CmdResponse exec(CommandContext context, HashMap<String, String> params) {
    CmdResponse response = new CmdResponse();
    ChannelConnector connector = getClientConnector(context);
    if (connector == null) {
        response.setResponse("请先登录!");
        return response;
    }
    // FIXME logout
    // connector.logout();
    CloseUtil.close(connector);
    setMessageBrowser(context, null);
    setClientConnector(context, null);
    response.setContinue(false);
    response.setResponse("系统退出!");
    return response;
}
Also used : CmdResponse(com.generallycloud.baseio.container.jms.cmd.CmdResponse) ChannelConnector(com.generallycloud.baseio.connector.ChannelConnector)

Example 2 with ChannelConnector

use of com.generallycloud.baseio.connector.ChannelConnector in project baseio by generallycloud.

the class ClientHttpFuture method updateWebSocketProtocol.

@Override
public void updateWebSocketProtocol() {
    ChannelConnector connector = (ChannelConnector) context.getChannelService();
    UnsafeSocketSession session = (UnsafeSocketSession) connector.getSession();
    SocketChannel channel = session.getSocketChannel();
    channel.setProtocolFactory(WebSocketProtocolFactory.WS_PROTOCOL_FACTORY);
    channel.setProtocolDecoder(WebSocketProtocolFactory.WS_PROTOCOL_DECODER);
    channel.setProtocolEncoder(WebSocketProtocolFactory.WS_PROTOCOL_ENCODER);
}
Also used : SocketChannel(com.generallycloud.baseio.component.SocketChannel) UnsafeSocketSession(com.generallycloud.baseio.component.UnsafeSocketSession) ChannelConnector(com.generallycloud.baseio.connector.ChannelConnector)

Example 3 with ChannelConnector

use of com.generallycloud.baseio.connector.ChannelConnector in project baseio by generallycloud.

the class DisconnectExecutable method exec.

@Override
public CmdResponse exec(CommandContext context, HashMap<String, String> params) {
    CmdResponse response = new CmdResponse();
    ChannelConnector connector = getClientConnector(context);
    if (connector == null) {
        response.setResponse("请先登录!");
        return response;
    }
    // FXIME logout
    // connector.logout();
    CloseUtil.close(connector);
    setMessageBrowser(context, null);
    setClientConnector(context, null);
    response.setResponse("已断开连接!");
    return response;
}
Also used : CmdResponse(com.generallycloud.baseio.container.jms.cmd.CmdResponse) ChannelConnector(com.generallycloud.baseio.connector.ChannelConnector)

Aggregations

ChannelConnector (com.generallycloud.baseio.connector.ChannelConnector)3 CmdResponse (com.generallycloud.baseio.container.jms.cmd.CmdResponse)2 SocketChannel (com.generallycloud.baseio.component.SocketChannel)1 UnsafeSocketSession (com.generallycloud.baseio.component.UnsafeSocketSession)1