blob: 4660c2d6135c93e070a1fe50ed5ce88c24f049c6 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>RemoteEndpoint</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="RemoteEndpoint";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../javax/websocket/PongMessage.html" title="interface in javax.websocket"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/websocket/RemoteEndpoint.Async.html" title="interface in javax.websocket"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/websocket/RemoteEndpoint.html" target="_top">Frames</a></li>
<li><a href="RemoteEndpoint.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">javax.websocket</div>
<h2 title="Interface RemoteEndpoint" class="title">Interface RemoteEndpoint</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../javax/websocket/RemoteEndpoint.Async.html" title="interface in javax.websocket">RemoteEndpoint.Async</a>, <a href="../../javax/websocket/RemoteEndpoint.Basic.html" title="interface in javax.websocket">RemoteEndpoint.Basic</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">RemoteEndpoint</span></pre>
<div class="block">The RemoteEndpoint object is supplied by the container and represents the 'other end' or peer of the Web Socket
conversation. Instances of the RemoteEndpoint are obtained from the Session using <a href="../../javax/websocket/Session.html#getBasicRemote--"><code>Session.getBasicRemote()</code></a> or
<a href="../../javax/websocket/Session.html#getAsyncRemote--"><code>Session.getAsyncRemote()</code></a>. Objects of this kind include numerous ways to send web socket messages. There are
two kinds of RemoteEndpoint objects: RemoteEndpoint.Basic for synchronous sending of websocket messages, and
RemoteEndpoint.Async for sending messages asynchronously.
<p>
There is no guarantee of the successful delivery of a web socket message to the peer, but if the action of sending a
message causes an error known to the container, the API throws it. RemoteEndpoints include a variety of ways to send
messages: by whole message, in parts, and in various data formats including websocket pings and pongs.
<p>
Implementations may or may not support batching of messages. More detail of the expected semantics of implementations
that do support batching are laid out in <a href="../../javax/websocket/RemoteEndpoint.html#setBatchingAllowed-boolean-"><code>setBatchingAllowed(boolean)</code></a>.
<p>
Note: Implementations may choose their own schemes for sending large messages in smaller parts. These schemes may or
may not bear a relationship to the underlying websocket dataframes in which the message is ultimately sent on the
wire.
<p>
If the underlying connection is closed and methods on the RemoteEndpoint are attempted to be called, they will result
in an error being generated. For the methods that send messages, this will be an IOException, for the methods that
alter configuration of the endpoint, this will be runtime IllegalArgumentExceptions.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Interface and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/RemoteEndpoint.Async.html" title="interface in javax.websocket">RemoteEndpoint.Async</a></span></code>
<div class="block">This representation of the peer of a web socket conversation has the ability to send messages asynchronously.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/RemoteEndpoint.Basic.html" title="interface in javax.websocket">RemoteEndpoint.Basic</a></span></code>
<div class="block">This representation of the peer of a web socket conversation has the ability to send messages synchronously.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/RemoteEndpoint.html#flushBatch--">flushBatch</a></span>()</code>
<div class="block">This method is only used when batching is allowed for this RemoteEndpint.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/RemoteEndpoint.html#getBatchingAllowed--">getBatchingAllowed</a></span>()</code>
<div class="block">Return whether the implementation is allowed to batch outgoing messages before sending.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/RemoteEndpoint.html#sendPing-java.nio.ByteBuffer-">sendPing</a></span>(java.nio.ByteBuffer&nbsp;applicationData)</code>
<div class="block">Send a Ping message containing the given application data to the remote endpoint.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/RemoteEndpoint.html#sendPong-java.nio.ByteBuffer-">sendPong</a></span>(java.nio.ByteBuffer&nbsp;applicationData)</code>
<div class="block">Allows the developer to send an unsolicited Pong message containing the given application data in order to serve
as a unidirectional heartbeat for the session.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/RemoteEndpoint.html#setBatchingAllowed-boolean-">setBatchingAllowed</a></span>(boolean&nbsp;allowed)</code>
<div class="block">Indicate to the implementation that it is allowed to batch outgoing messages before sending.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="setBatchingAllowed-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setBatchingAllowed</h4>
<pre>void&nbsp;setBatchingAllowed(boolean&nbsp;allowed)
throws java.io.IOException</pre>
<div class="block">Indicate to the implementation that it is allowed to batch outgoing messages before sending. Not all
implementations support batching of outgoing messages. The default mode for RemoteEndpoints is false. If the
developer has indicated that batching of outgoing messages is permitted, then the developer must call
flushBatch() in order to be sure that all the messages passed into the send methods of this RemoteEndpoint are
sent. When batching is allowed, the implementations send operations are considered to have completed if the
message has been written to the local batch, in the case when there is still room in the batch for the message,
and are considered to have completed if the batch has been send to the peer and the remainder written to the new
batch, in the case when writing the message causes the batch to need to be sent. The blocking and asynchronous
send methods use this notion of completion in order to complete blocking calls, notify SendHandlers and complete
Futures respectively. When batching is allowed, if the developer has called send methods on this RemoteEndpoint
without calling flushBatch(), then the implementation may not have sent all the messages the developer has asked
to be sent. If the parameter value is false and the implementation has a batch of unsent messages, then the
implementation must immediately send the batch of unsent messages.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>allowed</code> - whether the implementation is allowed to batch messages.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if batching is being disabled and there are unsent messages this error may be thrown as the
implementation sends the batch of unsent messages if there is a problem.</dd>
</dl>
</li>
</ul>
<a name="getBatchingAllowed--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBatchingAllowed</h4>
<pre>boolean&nbsp;getBatchingAllowed()</pre>
<div class="block">Return whether the implementation is allowed to batch outgoing messages before sending. The default mode for
RemoteEndpoints is false. The value may be changed by calling <a href="../../javax/websocket/RemoteEndpoint.html#setBatchingAllowed-boolean-"><code>setBatchingAllowed</code></a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the implementation is allowed to batch outgoing messages before sending, otherwise
<code>false</code></dd>
</dl>
</li>
</ul>
<a name="flushBatch--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>flushBatch</h4>
<pre>void&nbsp;flushBatch()
throws java.io.IOException</pre>
<div class="block">This method is only used when batching is allowed for this RemoteEndpint. Calling this method forces the
implementation to send any unsent messages it has been batching.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if the sending of any unsent messages failed</dd>
</dl>
</li>
</ul>
<a name="sendPing-java.nio.ByteBuffer-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendPing</h4>
<pre>void&nbsp;sendPing(java.nio.ByteBuffer&nbsp;applicationData)
throws java.io.IOException,
java.lang.IllegalArgumentException</pre>
<div class="block">Send a Ping message containing the given application data to the remote endpoint. The corresponding Pong message
may be picked up using the MessageHandler.Pong handler.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>applicationData</code> - the data to be carried in the ping request.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if the ping failed to be sent</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if the applicationData exceeds the maximum allowed payload of 125 bytes</dd>
</dl>
</li>
</ul>
<a name="sendPong-java.nio.ByteBuffer-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>sendPong</h4>
<pre>void&nbsp;sendPong(java.nio.ByteBuffer&nbsp;applicationData)
throws java.io.IOException,
java.lang.IllegalArgumentException</pre>
<div class="block">Allows the developer to send an unsolicited Pong message containing the given application data in order to serve
as a unidirectional heartbeat for the session.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>applicationData</code> - the application data to be carried in the pong response.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if the pong failed to be sent</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if the applicationData exceeds the maximum allowed payload of 125 bytes</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../javax/websocket/PongMessage.html" title="interface in javax.websocket"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/websocket/RemoteEndpoint.Async.html" title="interface in javax.websocket"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/websocket/RemoteEndpoint.html" target="_top">Frames</a></li>
<li><a href="RemoteEndpoint.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>