| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (17) on Thu Sep 15 14:12:07 CDT 2022 --> |
| <title>OnWebSocketMessage (Eclipse Jetty API Doc - v10.0.12)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2022-09-15"> |
| <meta name="description" content="declaration: package: org.eclipse.jetty.websocket.api.annotations, annotation type: OnWebSocketMessage"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../jquery-ui.overrides.css" title="Style"> |
| <script type="text/javascript" src="../../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../../script-dir/jquery-3.5.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var pathtoroot = "../../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">Class</li> |
| <li><a href="class-use/OnWebSocketMessage.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#class">Help</a></li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div> |
| <ul class="sub-nav-list"> |
| <li>Summary: </li> |
| <li>Field | </li> |
| <li>Optional | </li> |
| <li>Required</li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Element</li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><label for="search-input">SEARCH:</label> |
| <input type="text" id="search-input" value="search" disabled="disabled"> |
| <input type="reset" id="reset-button" value="reset" disabled="disabled"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.eclipse.jetty.websocket.api.annotations</a></div> |
| <h1 title="Annotation Type OnWebSocketMessage" class="title">Annotation Type OnWebSocketMessage</h1> |
| </div> |
| <section class="class-description" id="class-description"> |
| <hr> |
| <div class="type-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/annotation/Documented.html" title="class or interface in java.lang.annotation" class="external-link">@Documented</a> |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/annotation/Retention.html" title="class or interface in java.lang.annotation" class="external-link">@Retention</a>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/annotation/RetentionPolicy.html#RUNTIME" title="class or interface in java.lang.annotation" class="external-link">RUNTIME</a>) |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/annotation/Target.html" title="class or interface in java.lang.annotation" class="external-link">@Target</a>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/annotation/ElementType.html#METHOD" title="class or interface in java.lang.annotation" class="external-link">METHOD</a>) |
| </span><span class="modifiers">public @interface </span><span class="element-name type-name-label">OnWebSocketMessage</span></div> |
| <div class="block">Annotation for tagging methods to receive Binary or Text Message events. |
| <p> |
| Acceptable method patterns.<br> |
| Note: <code>methodName</code> can be any name you want to use. |
| <p> |
| <u>Text Message Versions</u> |
| <ol> |
| <li><code>public void methodName(String text)</code></li> |
| <li><code>public void methodName(Session session, String text)</code></li> |
| <li><code>public void methodName(Reader reader)</code></li> |
| <li><code>public void methodName(Session session, Reader reader)</code></li> |
| </ol> |
| <p>Note: that the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Reader.html" title="class or interface in java.io" class="external-link"><code>Reader</code></a> in this case will always use UTF-8 encoding/charset (this is dictated by the RFC 6455 spec for Text Messages. If you need to |
| use a non-UTF-8 encoding/charset, you are instructed to use the binary messaging techniques.</p> |
| <u>Binary Message Versions</u> |
| <ol> |
| <li><code>public void methodName(ByteBuffer message)</code></li> |
| <li><code>public void methodName(Session session, ByteBuffer message)</code></li> |
| <li><code>public void methodName(byte[] buf, int offset, int length)</code></li> |
| <li><code>public void methodName(Session session, byte[] buf, int offset, int length)</code></li> |
| <li><code>public void methodName(InputStream stream)</code></li> |
| <li><code>public void methodName(Session session, InputStream stream)</code></li> |
| </ol> |
| <u>Partial Message Variations</u> |
| <p>These are used to receive partial messages without aggregating them into a complete WebSocket message. Instead the a boolean |
| argument is supplied to indicate whether this is the last segment of data of the message. See <a href="../WebSocketPartialListener.html" title="interface in org.eclipse.jetty.websocket.api"><code>WebSocketPartialListener</code></a> |
| interface for more details on partial messages.</p> |
| <ol> |
| <li><code>public void methodName(ByteBuffer payload, boolean last)</code></li> |
| <li><code>public void methodName(String payload, boolean last)</code></li> |
| </ol> |
| <p>Note: Similar to the signatures above these can all be used with an optional first <a href="../Session.html" title="interface in org.eclipse.jetty.websocket.api"><code>Session</code></a> parameter.</p></div> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| <footer role="contentinfo"> |
| <hr> |
| <p class="legal-copy"><small>Copyright © 1995–2022 <a href="https://webtide.com">Webtide</a>. All rights reserved.</small></p> |
| </footer> |
| </div> |
| </div> |
| </body> |
| </html> |