Java Code Examples for javax.websocket.Session#getAsyncRemote()

The following examples show how to use javax.websocket.Session#getAsyncRemote() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MissionControlStatusEndpoint.java    From launchpad-missioncontrol with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example 2
Source File: ProcessProgressNotificationTest.java    From pnc with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 3
Source File: Client.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
Example 4
Source File: Client.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
Example 5
Source File: Client.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
Example 6
Source File: Client.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
Example 7
Source File: Client.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public Client(Session session) {
    this.session = session;
    this.async = session.getAsyncRemote();
}
 
Example 8
Source File: MessageSender.java    From everrest with Eclipse Public License 2.0 4 votes vote down vote up
public MessageSender(Session session) {
    this.session = session;
    async = session.getAsyncRemote();
    sendQueue = new LinkedList<>();
    sendHandler = new MessageSendHandler();
}