当前位置: 首页>>代码示例>>Java>>正文


Java WebSocketVersion.V13属性代码示例

本文整理汇总了Java中io.netty.handler.codec.http.websocketx.WebSocketVersion.V13属性的典型用法代码示例。如果您正苦于以下问题:Java WebSocketVersion.V13属性的具体用法?Java WebSocketVersion.V13怎么用?Java WebSocketVersion.V13使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在io.netty.handler.codec.http.websocketx.WebSocketVersion的用法示例。


在下文中一共展示了WebSocketVersion.V13属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWsVersion

static WebSocketVersion getWsVersion(String str) {
    switch (str) {
        case "0":
            return WebSocketVersion.V00;
        case "7":
            return WebSocketVersion.V07;
        case "8":
            return WebSocketVersion.V08;
        case "13":
            return WebSocketVersion.V13;
    }
    return WebSocketVersion.UNKNOWN;
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:13,代码来源:Utils.java

示例2: addToPipeline

@Override
public void addToPipeline(final ChannelPipeline pipeline) {
    pipeline.addLast("http-codec", new HttpClientCodec());
    pipeline.addLast("aggregator", new HttpObjectAggregator(8192));

    final WebSocketClientHandshaker handShaker = new WhiteSpaceInPathWebSocketClientHandshaker13(serverUri,
            WebSocketVersion.V13, PROTOCOL, false, createHttpHeaders(httpHeaders), Integer.MAX_VALUE);
    pipeline.addLast("websocket-protocol-handler", new WebSocketClientProtocolHandler(handShaker));

    pipeline.addLast("websocket-frame-codec", new ByteBufToWebSocketFrameCodec());
}
 
开发者ID:saxsys,项目名称:SynchronizeFX,代码行数:11,代码来源:WebsocketChannelInitializer.java

示例3: connect

@Override
public void connect(WsClient client) {
    if (client == null) {
        throw new NullPointerException("client");
    }
    final URLInfo url = client.getUrl();
    String full = url.protocol + "://" + url.host
            + ":" + url.port + url.path;
    URI uri;
    try {
        uri = new URI(full);
    } catch (URISyntaxException e) {
        throw new RuntimeException(e);
    }
    WebSocketVersion v = WebSocketVersion.V13;
    HttpHeaders h = new DefaultHttpHeaders();
    final WebSocketClientHandshaker wsch = WebSocketClientHandshakerFactory
            .newHandshaker(uri, v, null, true, h, Integer.MAX_VALUE);
    final WebSocketHandler handler = new WebSocketHandler(wsch, client);

    Bootstrap b = new Bootstrap();
    b.group(SharedObjects.getLoop());
    b.channel(NioSocketChannel.class);
    b.handler(new ChannelInitializer<SocketChannel>() {
        @Override
        protected void initChannel(SocketChannel ch) throws Exception {
            ChannelPipeline p = ch.pipeline();
            if (url.secure) {
                TrustManagerFactory man = InsecureTrustManagerFactory.INSTANCE;
                SslContext con = SslContext.newClientContext(man);
                p.addLast(con.newHandler(ch.alloc()));
            }

            p.addLast(new HttpClientCodec());
            p.addLast(new HttpObjectAggregator(8192));
            p.addLast(handler);
        }
    });

    ChannelFuture fut = b.connect(url.host, url.port);
    fut.syncUninterruptibly();
    handler.handshakeFuture().syncUninterruptibly();
}
 
开发者ID:IOT-DSA,项目名称:dslink-java-android,代码行数:43,代码来源:AndroidWsProvider.java


注:本文中的io.netty.handler.codec.http.websocketx.WebSocketVersion.V13属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。