javax.websocket.Session#getAsyncRemote ( )源码实例Demo

下面列出了javax.websocket.Session#getAsyncRemote ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@OnOpen
public void onOpen(Session session, @PathParam("uuid") String uuid) {
    UUID key = UUID.fromString(uuid);
    peers.put(key, session);
    JsonArrayBuilder builder = Json.createArrayBuilder();
    for (StatusMessage statusMessage : StatusMessage.values()) {
        JsonObjectBuilder object = Json.createObjectBuilder();
        builder.add(object.add(statusMessage.name(), statusMessage.getMessage()).build());
    }

    RemoteEndpoint.Async asyncRemote = session.getAsyncRemote();
    asyncRemote.sendText(builder.build().toString());
    // Send pending messages
    List<String> messages = messageBuffer.remove(key);
    if (messages != null) {
        messages.forEach(asyncRemote::sendText);
    }
}
 
源代码2 项目: pnc   文件: ProcessProgressNotificationTest.java
@Before
public void before() throws Exception {
    notificationCollector = new NotificationCollector();
    WebSocketContainer container = ContainerProvider.getWebSocketContainer();
    String uri = "ws://localhost:8080/pnc-rest-new/" + NotificationsEndpoint.ENDPOINT_PATH;
    Session session = container.connectToServer(notificationCollector, URI.create(uri));
    waitForWSClientConnection();
    notificationCollector.clear();
    asyncRemote = session.getAsyncRemote();
}
 
源代码3 项目: Tomcat8-Source-Read   文件: Client.java
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
源代码4 项目: Tomcat8-Source-Read   文件: Client.java
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
源代码5 项目: tomcatsrc   文件: Client.java
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
源代码6 项目: tomcatsrc   文件: Client.java
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
源代码7 项目: tomcatsrc   文件: Client.java
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
源代码8 项目: everrest   文件: MessageSender.java
public MessageSender(Session session) {
    this.session = session;
    async = session.getAsyncRemote();
    sendQueue = new LinkedList<>();
    sendHandler = new MessageSendHandler();
}