use of org.eclipse.jetty.websocket.api.RemoteEndpoint in project jetty.project by eclipse.
the class SessionSocket method sendString.
protected void sendString(String text) throws IOException {
RemoteEndpoint remote = session.getRemote();
remote.sendString(text, null);
if (remote.getBatchMode() == BatchMode.ON)
remote.flush();
}
use of org.eclipse.jetty.websocket.api.RemoteEndpoint in project jetty.project by eclipse.
the class BigEchoSocket method onBinary.
@OnWebSocketMessage
public void onBinary(Session session, byte[] buf, int offset, int length) throws IOException {
if (!session.isOpen()) {
LOG.warn("Session is closed");
return;
}
RemoteEndpoint remote = session.getRemote();
remote.sendBytes(ByteBuffer.wrap(buf, offset, length), null);
if (remote.getBatchMode() == BatchMode.ON)
remote.flush();
}
use of org.eclipse.jetty.websocket.api.RemoteEndpoint in project jetty.project by eclipse.
the class EchoSocket method onBinary.
@OnWebSocketMessage
public void onBinary(byte[] buf, int offset, int len) throws IOException {
LOG.debug("onBinary(byte[{}],{},{})", buf.length, offset, len);
// echo the message back.
ByteBuffer data = ByteBuffer.wrap(buf, offset, len);
RemoteEndpoint remote = this.session.getRemote();
remote.sendBytes(data, null);
if (remote.getBatchMode() == BatchMode.ON)
remote.flush();
}
use of org.eclipse.jetty.websocket.api.RemoteEndpoint in project jetty.project by eclipse.
the class EchoSocket method onText.
@OnWebSocketMessage
public void onText(String message) throws IOException {
LOG.debug("onText({})", message);
// echo the message back.
RemoteEndpoint remote = session.getRemote();
remote.sendString(message, null);
if (remote.getBatchMode() == BatchMode.ON)
remote.flush();
}
use of org.eclipse.jetty.websocket.api.RemoteEndpoint in project jetty.project by eclipse.
the class RFCSocket method onBinary.
@OnWebSocketMessage
public void onBinary(byte[] buf, int offset, int len) throws IOException {
LOG.debug("onBinary(byte[{}],{},{})", buf.length, offset, len);
// echo the message back.
ByteBuffer data = ByteBuffer.wrap(buf, offset, len);
RemoteEndpoint remote = session.getRemote();
remote.sendBytes(data, null);
if (remote.getBatchMode() == BatchMode.ON)
remote.flush();
}
Aggregations