Java Code Examples for javax.websocket.RemoteEndpoint#Async
The following examples show how to use
javax.websocket.RemoteEndpoint#Async .
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 |
@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: Util.java From PeonyFramwork with Apache License 2.0 | 5 votes |
public static String getIp(javax.websocket.Session session){ RemoteEndpoint.Async async = session.getAsyncRemote(); InetSocketAddress addr = (InetSocketAddress) getFieldInstance(async, "base#sos#socketWrapper#socket#sc#remoteAddress"); if(addr == null){ return "127.0.0.1"; } return addr.getAddress().getHostAddress(); }
Example 3
Source File: WsSession.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Override public RemoteEndpoint.Async getAsyncRemote() { checkState(); return remoteEndpointAsync; }
Example 4
Source File: UndertowSession.java From quarkus-http with Apache License 2.0 | 4 votes |
@Override public RemoteEndpoint.Async getAsyncRemote() { return remote.getAsync(); }
Example 5
Source File: WsSession.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override public RemoteEndpoint.Async getAsyncRemote() { checkState(); return remoteEndpointAsync; }
Example 6
Source File: MCRWebCLIResourceSockets.java From mycore with GNU General Public License v3.0 | 4 votes |
@Override public RemoteEndpoint.Async getAsyncRemote() { return delegate.getAsyncRemote(); }
Example 7
Source File: WsSession.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override public RemoteEndpoint.Async getAsyncRemote() { checkState(); return remoteEndpointAsync; }
Example 8
Source File: MockSession.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
@Override public RemoteEndpoint.Async getAsyncRemote() { return asyncRemote; }
Example 9
Source File: BinaryFrameOutputStream.java From websocket-classloader with Apache License 2.0 | 4 votes |
public BinaryFrameOutputStream(RemoteEndpoint.Async remote) { this.buffer = ByteBuffer.allocate(DEFAULT_BUFFER_SIZE); this.remote = remote; }