blob: 496a5f2edcbca7a7545599ad6b4525ea79d8bb4d [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>
<!-- Generated by javadoc (1.8.0_112) on Mon Dec 18 11:25:21 EST 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WebSocketClient (Apache Edgent (incubating) v1.2.0 API)</title>
<meta name="date" content="2017-12-18">
<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="WebSocketClient (Apache Edgent (incubating) v1.2.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":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="class-use/WebSocketClient.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">
<li>Prev&nbsp;Class</li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/edgent/connectors/wsclient/WebSocketClient.html" target="_top">Frames</a></li>
<li><a href="WebSocketClient.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>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 name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.edgent.connectors.wsclient</div>
<h2 title="Interface WebSocketClient" class="title">Interface WebSocketClient</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="../../../../../org/apache/edgent/topology/TopologyElement.html" title="interface in org.apache.edgent.topology">TopologyElement</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/apache/edgent/connectors/wsclient/javax/websocket/Jsr356WebSocketClient.html" title="class in org.apache.edgent.connectors.wsclient.javax.websocket">Jsr356WebSocketClient</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">WebSocketClient</span>
extends <a href="../../../../../org/apache/edgent/topology/TopologyElement.html" title="interface in org.apache.edgent.topology">TopologyElement</a></pre>
<div class="block">A generic connector for sending and receiving messages to a WebSocket Server.
<p>
A connector is bound to its configuration specified
<code>javax.websockets</code> WebSocket URI.
<p>
A single connector instance supports sinking at most one stream
and sourcing at most one stream.
<p>
Sample use:
<pre><code>
// assuming a properties file containing at least:
// ws.uri=ws://myWsServerHost/myService
String propsPath = &lt;path to properties file&gt;;
Properties properties = new Properties();
properties.load(Files.newBufferedReader(new File(propsPath).toPath()));
Topology t = ...;
Jsr356WebSocketClient wsclient = new SomeWebSocketClient(t, properties);
// send a stream's JsonObject tuples as JSON WebSocket text messages
TStream&lt;JsonObject&gt; s = ...;
wsclient.send(s);
// create a stream of JsonObject tuples from received JSON WebSocket text messages
TStream&lt;JsonObject&gt; r = wsclient.receive();
r.print();
</code></pre>
<p>
Note, the WebSocket protocol differentiates between text/String and
binary/byte messages.
A receiver only receives the messages of the type that it requests.
<p>
Implementations are strongly encouraged to support construction from
Properties with the following configuration parameters:
<ul>
<li>ws.uri - "ws://host[:port][/path]", "wss://host[:port][/path]"
the default port is 80 and 443 for "ws" and "wss" respectively.
The optional path must match the server's configuration.</li>
<li>ws.trustStore - optional. Only used with "wss:".
Path to trust store file in JKS format.
If not set, the standard JRE and javax.net.ssl system properties
control the SSL behavior.
Generally not required if server has a CA-signed certificate.</li>
<li>ws.trustStorePassword - required if ws.trustStore is set</li>
<li>ws.keyStore - optional. Only used with "wss:" when the
server is configured for client auth.
Path to key store file in JKS format.
If not set, the standard JRE and javax.net.ssl system properties
control the SSL behavior.</li>
<li>ws.keyStorePassword - required if ws.keyStore is set.</li>
<li>ws.keyPassword - defaults to ws.keyStorePassword value</li>
<li>ws.keyCertificateAlias - alias for certificate in key store. defaults to "default"</li>
</ul></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== 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><a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;com.google.gson.JsonObject&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/wsclient/WebSocketClient.html#receive--">receive</a></span>()</code>
<div class="block">Create a stream of JsonObject tuples from received JSON WebSocket text messages.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;byte[]&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/wsclient/WebSocketClient.html#receiveBytes--">receiveBytes</a></span>()</code>
<div class="block">Create a stream of byte[] tuples from received WebSocket binary messages.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/wsclient/WebSocketClient.html#receiveString--">receiveString</a></span>()</code>
<div class="block">Create a stream of String tuples from received WebSocket text messages.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;com.google.gson.JsonObject&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/wsclient/WebSocketClient.html#send-org.apache.edgent.topology.TStream-">send</a></span>(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;com.google.gson.JsonObject&gt;&nbsp;stream)</code>
<div class="block">Send a stream's JsonObject tuples as JSON in a WebSocket text message.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;byte[]&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/wsclient/WebSocketClient.html#sendBytes-org.apache.edgent.topology.TStream-">sendBytes</a></span>(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;byte[]&gt;&nbsp;stream)</code>
<div class="block">Send a stream's byte[] tuples in a WebSocket binary message.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/wsclient/WebSocketClient.html#sendString-org.apache.edgent.topology.TStream-">sendString</a></span>(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;stream)</code>
<div class="block">Send a stream's String tuples in a WebSocket text message.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.edgent.topology.TopologyElement">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;org.apache.edgent.topology.<a href="../../../../../org/apache/edgent/topology/TopologyElement.html" title="interface in org.apache.edgent.topology">TopologyElement</a></h3>
<code><a href="../../../../../org/apache/edgent/topology/TopologyElement.html#topology--">topology</a></code></li>
</ul>
</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="send-org.apache.edgent.topology.TStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>send</h4>
<pre><a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;com.google.gson.JsonObject&gt;&nbsp;send(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;com.google.gson.JsonObject&gt;&nbsp;stream)</pre>
<div class="block">Send a stream's JsonObject tuples as JSON in a WebSocket text message.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>stream</code> - the stream</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>sink</dd>
</dl>
</li>
</ul>
<a name="sendString-org.apache.edgent.topology.TStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendString</h4>
<pre><a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;sendString(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;stream)</pre>
<div class="block">Send a stream's String tuples in a WebSocket text message.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>stream</code> - the stream</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>sink</dd>
</dl>
</li>
</ul>
<a name="sendBytes-org.apache.edgent.topology.TStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendBytes</h4>
<pre><a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;byte[]&gt;&nbsp;sendBytes(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;byte[]&gt;&nbsp;stream)</pre>
<div class="block">Send a stream's byte[] tuples in a WebSocket binary message.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>stream</code> - the stream</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>sink</dd>
</dl>
</li>
</ul>
<a name="receive--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>receive</h4>
<pre><a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;com.google.gson.JsonObject&gt;&nbsp;receive()</pre>
<div class="block">Create a stream of JsonObject tuples from received JSON WebSocket text messages.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the stream</dd>
</dl>
</li>
</ul>
<a name="receiveString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>receiveString</h4>
<pre><a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;receiveString()</pre>
<div class="block">Create a stream of String tuples from received WebSocket text messages.
<p>
Note, the WebSocket protocol differentiates between text/String and
binary/byte messages. This method only receives messages sent as text.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the stream</dd>
</dl>
</li>
</ul>
<a name="receiveBytes--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>receiveBytes</h4>
<pre><a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;byte[]&gt;&nbsp;receiveBytes()</pre>
<div class="block">Create a stream of byte[] tuples from received WebSocket binary messages.
<p>
Note, the WebSocket protocol differentiates between text/String and
binary/byte messages. This method only receives messages sent as bytes.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the stream</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="class-use/WebSocketClient.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">
<li>Prev&nbsp;Class</li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/edgent/connectors/wsclient/WebSocketClient.html" target="_top">Frames</a></li>
<li><a href="WebSocketClient.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>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 name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2016&#x2013;2017 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>