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


Java WebSocketChannel.resumeReceives方法代码示例

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


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

示例1: onConnect

import io.undertow.websockets.core.WebSocketChannel; //导入方法依赖的package包/类
@Override
public void onConnect(WebSocketHttpExchange exchange, WebSocketChannel channel) {
    if (this.hasAuthentication) {
        String header = null;
        if (exchange.getRequestHeader(Header.COOKIE.toString()) != null) {
            header = exchange.getRequestHeader(Header.COOKIE.toString());
        }

        if (this.requestHelper.hasValidAuthentication(header)) {
            channel.getReceiveSetter().set((ChannelListener<? super WebSocketChannel>) Application.getInstance(this.controllerClass));
            channel.resumeReceives();
            channel.addCloseTask(Application.getInstance(WebSocketCloseListener.class));
            Application.getInstance(WebSocketService.class).addChannel(channel);
        } else {
            IOUtils.closeQuietly(channel);
        }
    } else {
        channel.getReceiveSetter().set((ChannelListener<? super WebSocketChannel>) Application.getInstance(this.controllerClass));
        channel.resumeReceives();
        channel.addCloseTask(Application.getInstance(WebSocketCloseListener.class));
        Application.getInstance(WebSocketService.class).addChannel(channel);
    }
}
 
开发者ID:svenkubiak,项目名称:mangooio,代码行数:24,代码来源:WebSocketHandler.java

示例2: run

import io.undertow.websockets.core.WebSocketChannel; //导入方法依赖的package包/类
void run() throws Exception {
	CountDownLatch closelatch = new CountDownLatch(2);
	server(app.websocket("/ws").onClose(
			(c, buf) -> closelatch.countDown()));
	stopper = app.listen(port);
	CountDownLatch latch = new CountDownLatch(1);
	WebSocketChannel channel = WebSocketClient
			.connectionBuilder(
					worker,
					buffer,
					new URI(String.format("http://localhost:%d/ws",
							port))).connect().get();

	channel.addCloseTask(c -> closelatch.countDown());
	channel.getReceiveSetter().set(listener(latch));
	channel.resumeReceives();
	try {
		assertion(channel, latch);
	} finally {
		if (channel.isOpen()) {
			channel.sendClose();
			closelatch.await(1, TimeUnit.SECONDS);
		}
	}
}
 
开发者ID:taichi,项目名称:siden,代码行数:26,代码来源:WebSocketTest.java

示例3: onConnect

import io.undertow.websockets.core.WebSocketChannel; //导入方法依赖的package包/类
@Override
public void onConnect(final WebSocketHttpExchange exchange, final WebSocketChannel channel) {
    channel.getReceiveSetter().set(new UaiWebSocketListener());

    UaiWebSocketContext.addClient(channel);

    channel.resumeReceives();
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:9,代码来源:UaiWebSocketCallback.java

示例4: WebSocketTtyConnection

import io.undertow.websockets.core.WebSocketChannel; //导入方法依赖的package包/类
public WebSocketTtyConnection(WebSocketChannel webSocketChannel, ScheduledExecutorService executor) {
    this.webSocketChannel = webSocketChannel;
    this.executor = executor;

    registerWebSocketChannelListener(webSocketChannel);
    webSocketChannel.resumeReceives();
}
 
开发者ID:aeshell,项目名称:aesh-readline,代码行数:8,代码来源:WebSocketTtyConnection.java

示例5: WebSocketTtyConnection

import io.undertow.websockets.core.WebSocketChannel; //导入方法依赖的package包/类
public WebSocketTtyConnection(WebSocketChannel webSocketChannel, ScheduledExecutorService executor) {
  this.webSocketChannel = webSocketChannel;
  this.executor = executor;

  registerWebSocketChannelListener(webSocketChannel);
  webSocketChannel.resumeReceives();
}
 
开发者ID:termd,项目名称:termd,代码行数:8,代码来源:WebSocketTtyConnection.java

示例6: onConnect

import io.undertow.websockets.core.WebSocketChannel; //导入方法依赖的package包/类
@Override
public void onConnect(WebSocketHttpExchange exchange, WebSocketChannel channel) {
  LOGGER.info("Connecting: " + this + " to " + channel);
  WebSocketSession wss = new WebSocketSession(channel, ev3ActionProcessor);
  sessions.add(wss);
  if (sessions.size() > 5) {
    // Potential issue on CPU and bandwidth (seems limited to 128Kb/s with Wifi)
    LOGGER.warning("Important number (" + sessions.size() + ") of session opened at the same time: Potential performance issues");
  }
  channel.resumeReceives(); // /!\ channel don't receive nothing if not called
}
 
开发者ID:jbenech,项目名称:gnikrap,代码行数:12,代码来源:EV3SriptCommandSocketConnectionCallback.java

示例7: onConnect

import io.undertow.websockets.core.WebSocketChannel; //导入方法依赖的package包/类
@Override
public void onConnect(WebSocketHttpExchange exchange, WebSocketChannel channel) {
    channel.getReceiveSetter().set(this);
    channel.resumeReceives();

    connection = new UndertowWebSocketConnection(exchange, channel);
    connections.add(connection);
    context = new WebSocketContext(connections, connection, pathParameters);

    handler.onOpen(context);
}
 
开发者ID:decebals,项目名称:pippo,代码行数:12,代码来源:UndertowWebSocketAdapter.java


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