blob: 1ac5920a5f0c58b3d18e906fae663e3e13626f63 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.11) on Mon Jun 14 16:44:01 EDT 2021 -->
<title>FrameHandler (Eclipse Jetty API Doc - v11.0.5)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-06-14">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="FrameHandler (Eclipse Jetty API Doc - v11.0.5)";
}
}
catch(err) {
}
//-->
var data = {"i0":18,"i1":6,"i2":6,"i3":6,"i4":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/FrameHandler.html">Use</a></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" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&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 id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.eclipse.jetty.websocket.core</a></div>
<h2 title="Interface FrameHandler" class="title">Interface FrameHandler</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><code><a href="IncomingFrames.html" title="interface in org.eclipse.jetty.websocket.core">IncomingFrames</a></code></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="../jakarta/common/JakartaWebSocketFrameHandler.html" title="class in org.eclipse.jetty.websocket.jakarta.common">JakartaWebSocketFrameHandler</a></code>, <code><a href="../common/JettyWebSocketFrameHandler.html" title="class in org.eclipse.jetty.websocket.common">JettyWebSocketFrameHandler</a></code>, <code><a href="internal/MessageHandler.html" title="class in org.eclipse.jetty.websocket.core.internal">MessageHandler</a></code></dd>
</dl>
<hr>
<pre>public interface <span class="typeNameLabel">FrameHandler</span>
extends <a href="IncomingFrames.html" title="interface in org.eclipse.jetty.websocket.core">IncomingFrames</a></pre>
<div class="block">Interface for local WebSocket Endpoint Frame handling.
<p>
This is the receiver of Parsed Frames. It is implemented by the Application (or Application API layer or Framework)
as the primary API to/from the Core websocket implementation. The instance to be used for each websocket connection
is instantiated by the application, either:
</p>
<ul>
<li>On the server, the application layer must provide a <code>org.eclipse.jetty.websocket.core.server.WebSocketNegotiator</code> instance
to negotiate and accept websocket connections, which will return the FrameHandler instance to use from
<code>org.eclipse.jetty.websocket.core.server.WebSocketNegotiator#negotiate(Negotiation)</code>.</li>
<li>On the client, the application returns the FrameHandler instance to user from the <code>ClientUpgradeRequest</code>
instance that it passes to the <code>org.eclipse.jetty.websocket.core.client.WebSocketCoreClient#connect(ClientUpgradeRequest)</code> method/</li>
</ul>
<p>
Once instantiated the FrameHandler follows is used as follows:
</p>
<ul>
<li>The <a href="#onOpen(org.eclipse.jetty.websocket.core.CoreSession,org.eclipse.jetty.util.Callback)"><code>onOpen(CoreSession, Callback)</code></a> method is called when negotiation of the connection is completed. The passed <a href="CoreSession.html" title="interface in org.eclipse.jetty.websocket.core"><code>CoreSession</code></a> instance is used
to obtain information about the connection and to send frames</li>
<li>Every data and control frame received is passed to <a href="#onFrame(org.eclipse.jetty.websocket.core.Frame,org.eclipse.jetty.util.Callback)"><code>onFrame(Frame, Callback)</code></a>.</li>
<li>Received Control Frames that require a response (eg Ping, Close) are first passed to the <a href="#onFrame(org.eclipse.jetty.websocket.core.Frame,org.eclipse.jetty.util.Callback)"><code>onFrame(Frame, Callback)</code></a> to give the
Application an opportunity to send the response itself. If an appropriate response has not been sent when the callback passed is completed, then a
response will be generated.</li>
<li>If an error is detected or received, then <a href="#onError(java.lang.Throwable,org.eclipse.jetty.util.Callback)"><code>onError(Throwable, Callback)</code></a> will be called to inform the application of the cause of the problem.
The connection will then be closed or aborted and the <a href="#onClosed(org.eclipse.jetty.websocket.core.CloseStatus,org.eclipse.jetty.util.Callback)"><code>onClosed(CloseStatus, Callback)</code></a> method called.</li>
<li>The <a href="#onClosed(org.eclipse.jetty.websocket.core.CloseStatus,org.eclipse.jetty.util.Callback)"><code>onClosed(CloseStatus, Callback)</code></a> method is always called once a websocket connection is terminated, either gracefully or not. The error code
will indicate the nature of the close.</li>
</ul></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<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><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>default boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isDemanding()">isDemanding</a></span>()</code></th>
<td class="colLast">
<div class="block">Does the FrameHandler manage it's own demand?</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onClosed(org.eclipse.jetty.websocket.core.CloseStatus,org.eclipse.jetty.util.Callback)">onClosed</a></span>&#8203;(<a href="CloseStatus.html" title="class in org.eclipse.jetty.websocket.core">CloseStatus</a>&nbsp;closeStatus,
<a href="../../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback)</code></th>
<td class="colLast">
<div class="block">This is the Close Handshake Complete event.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onError(java.lang.Throwable,org.eclipse.jetty.util.Callback)">onError</a></span>&#8203;(java.lang.Throwable&nbsp;cause,
<a href="../../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback)</code></th>
<td class="colLast">
<div class="block">An error has occurred or been detected in websocket-core and being reported to FrameHandler.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onFrame(org.eclipse.jetty.websocket.core.Frame,org.eclipse.jetty.util.Callback)">onFrame</a></span>&#8203;(<a href="Frame.html" title="class in org.eclipse.jetty.websocket.core">Frame</a>&nbsp;frame,
<a href="../../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback)</code></th>
<td class="colLast">
<div class="block">Receiver of all Frames.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onOpen(org.eclipse.jetty.websocket.core.CoreSession,org.eclipse.jetty.util.Callback)">onOpen</a></span>&#8203;(<a href="CoreSession.html" title="interface in org.eclipse.jetty.websocket.core">CoreSession</a>&nbsp;coreSession,
<a href="../../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback)</code></th>
<td class="colLast">
<div class="block">Async notification that Connection is being opened.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="onOpen(org.eclipse.jetty.websocket.core.CoreSession,org.eclipse.jetty.util.Callback)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onOpen</h4>
<pre class="methodSignature">void&nbsp;onOpen&#8203;(<a href="CoreSession.html" title="interface in org.eclipse.jetty.websocket.core">CoreSession</a>&nbsp;coreSession,
<a href="../../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback)</pre>
<div class="block">Async notification that Connection is being opened.
<p>
FrameHandler can write during this call, but can not receive frames until the callback is succeeded.
</p>
<p>
If the FrameHandler succeeds the callback we transition to OPEN state and can now receive frames if
not demanding, or can now call <a href="CoreSession.html#demand(long)"><code>CoreSession.demand(long)</code></a> to receive frames if demanding.
If the FrameHandler fails the callback a close frame will be sent with <a href="CloseStatus.html#SERVER_ERROR"><code>CloseStatus.SERVER_ERROR</code></a> and
the connection will be closed. <br>
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>coreSession</code> - the session associated with this connection.</dd>
<dd><code>callback</code> - the callback to indicate success in processing (or failure)</dd>
</dl>
</li>
</ul>
<a id="onFrame(org.eclipse.jetty.websocket.core.Frame,org.eclipse.jetty.util.Callback)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onFrame</h4>
<pre class="methodSignature">void&nbsp;onFrame&#8203;(<a href="Frame.html" title="class in org.eclipse.jetty.websocket.core">Frame</a>&nbsp;frame,
<a href="../../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback)</pre>
<div class="block">Receiver of all Frames.
This method will never be called in parallel for the same session and will be called
sequentially to satisfy all outstanding demand signaled by calls to
<a href="CoreSession.html#demand(long)"><code>CoreSession.demand(long)</code></a>.
Control and Data frames are passed to this method.
Close frames may be responded to by the handler, but if an appropriate close response is not
sent once the callback is succeeded, then a response close will be generated and sent.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="IncomingFrames.html#onFrame(org.eclipse.jetty.websocket.core.Frame,org.eclipse.jetty.util.Callback)">onFrame</a></code>&nbsp;in interface&nbsp;<code><a href="IncomingFrames.html" title="interface in org.eclipse.jetty.websocket.core">IncomingFrames</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>frame</code> - the raw frame</dd>
<dd><code>callback</code> - the callback to indicate success in processing frame (or failure)</dd>
</dl>
</li>
</ul>
<a id="onError(java.lang.Throwable,org.eclipse.jetty.util.Callback)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onError</h4>
<pre class="methodSignature">void&nbsp;onError&#8203;(java.lang.Throwable&nbsp;cause,
<a href="../../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback)</pre>
<div class="block">An error has occurred or been detected in websocket-core and being reported to FrameHandler.
A call to onError will be followed by a call to <a href="#onClosed(org.eclipse.jetty.websocket.core.CloseStatus,org.eclipse.jetty.util.Callback)"><code>onClosed(CloseStatus, Callback)</code></a> giving the close status
derived from the error. This will not be called more than once, <a href="#onClosed(org.eclipse.jetty.websocket.core.CloseStatus,org.eclipse.jetty.util.Callback)"><code>onClosed(CloseStatus, Callback)</code></a>
will be called on the callback completion.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cause</code> - the reason for the error</dd>
<dd><code>callback</code> - the callback to indicate success in processing (or failure)</dd>
</dl>
</li>
</ul>
<a id="onClosed(org.eclipse.jetty.websocket.core.CloseStatus,org.eclipse.jetty.util.Callback)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onClosed</h4>
<pre class="methodSignature">void&nbsp;onClosed&#8203;(<a href="CloseStatus.html" title="class in org.eclipse.jetty.websocket.core">CloseStatus</a>&nbsp;closeStatus,
<a href="../../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback)</pre>
<div class="block">This is the Close Handshake Complete event.
<p>
The connection is now closed, no reading or writing is possible anymore.
Implementations of FrameHandler can cleanup their resources for this connection now.
This method will be called only once.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>closeStatus</code> - the close status received from remote, or in the case of abnormal closure from local.</dd>
<dd><code>callback</code> - the callback to indicate success in processing (or failure)</dd>
</dl>
</li>
</ul>
<a id="isDemanding()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isDemanding</h4>
<pre class="methodSignature">default&nbsp;boolean&nbsp;isDemanding()</pre>
<div class="block">Does the FrameHandler manage it's own demand?</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true iff the FrameHandler will manage its own flow control by calling <a href="CoreSession.html#demand(long)"><code>CoreSession.demand(long)</code></a> when it
is willing to receive new Frames. Otherwise the demand will be managed by an automatic call to demand(1) after every
succeeded callback passed to <a href="#onFrame(org.eclipse.jetty.websocket.core.Frame,org.eclipse.jetty.util.Callback)"><code>onFrame(Frame, Callback)</code></a>.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/FrameHandler.html">Use</a></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" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&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 id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 1995&#x2013;2021 <a href="https://webtide.com">Webtide</a>. All rights reserved.</small></p>
</footer>
</body>
</html>