/** * {@inheritDoc} */ @Override public void broadcast(final Iterable<? extends WebSocket> recipients, final byte[] binary) { for (WebSocket websocket : recipients) { if (websocket.isConnected()) { try { websocket.send(binary); } catch (WebSocketException ignored) { } } } }
/** * {@inheritDoc} */ @Override public void broadcastFragment(final Iterable<? extends WebSocket> recipients, final byte[] binary, final boolean last) { for (WebSocket websocket : recipients) { if (websocket.isConnected()) { try { websocket.stream(last, binary, 0, binary.length); } catch (WebSocketException ignored) { } } } }
public void respond(WebSocket socket, DataFrame frame) { if(frame.isLast()) { socket.onMessage(frame.getTextPayload()); } else { socket.onFragment(frame.isLast(), frame.getTextPayload()); } } }
ws.onConnect(); WebSocketHolder.set(ctx.getConnection(), context.protocolHandler, ws); ((WebSocketUpgradeHandler) context.getAsyncHandler()).onSuccess(context.webSocket);
public void doClose(int code, String reason) throws IOException { this.grizzlySocket.close(code, reason); }
@Override public void sendString(String text) throws IOException { this.socket.send(text); }
public void respond(WebSocket socket, DataFrame frame) { socket.onPing(frame); } }
public void respond(WebSocket socket, DataFrame frame) { socket.onPong(frame); }
public boolean isValid() { if (!socket.isConnected()) { isValid = false; } return isValid; }
public void respond(WebSocket socket, DataFrame frame) { if (text) { socket.onFragment(frame.isLast(), frame.getTextPayload()); } else { socket.onFragment(frame.isLast(), frame.getBytes()); } }
@Override public void completed(DataFrame result) { if (!maskData) { webSocket.onClose(closingFrame); } } });
@Override public void sendPartialString(String fragment, boolean isLast) throws IOException { socket.stream(isLast,fragment); }
public void respond(WebSocket socket, DataFrame frame) { if (!frame.isLast()) { socket.onFragment(frame.isLast(), frame.getBytes()); } else { socket.onMessage(frame.getBytes()); } }
private static NextAction handleClientHandShake(FilterChainContext ctx, HttpContent content) { final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); holder.handshake.validateServerResponse((HttpResponsePacket) content.getHttpHeader()); holder.webSocket.onConnect(); if (content.getContent().hasRemaining()) { return ctx.getRerunFilterAction(); } else { content.recycle(); return ctx.getStopAction(); } } }
public void expire() throws IOException { this.socket.close(); this.properties = new HashMap(); this.setValid(false); }
public void sendMessage(String data) throws IOException { this.grizzlySocket.send(data); }
public void respond(WebSocket socket, DataFrame frame) { socket.onPing(frame); } }