Skip to content

Commit 4386cc4

Browse files
committed
2 parents 118d4f6 + 086372f commit 4386cc4

File tree

6 files changed

+27
-35
lines changed

6 files changed

+27
-35
lines changed

doc/Streamdata.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ <h5>Returns:</h5>
345345

346346
<span class="jsdoc-message">
347347
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a>
348-
on Wed Apr 01 2015 18:12:00 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
348+
on Fri Apr 03 2015 11:48:43 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
349349
</span>
350350
</footer>
351351
</div>

doc/StreamdataError.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ <h5>Returns:</h5>
711711

712712
<span class="jsdoc-message">
713713
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a>
714-
on Wed Apr 01 2015 18:12:00 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
714+
on Fri Apr 03 2015 11:48:43 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
715715
</span>
716716
</footer>
717717
</div>

doc/StreamdataEventSource.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1878,7 +1878,7 @@ <h5>Returns:</h5>
18781878

18791879
<span class="jsdoc-message">
18801880
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a>
1881-
on Wed Apr 01 2015 18:12:00 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
1881+
on Fri Apr 03 2015 11:48:43 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
18821882
</span>
18831883
</footer>
18841884
</div>

doc/api.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ <h1 class="page-title">Source: /home/slave/workspace/JavascriptSDK_Compile/src/a
331331

332332
<span class="jsdoc-message">
333333
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a>
334-
on Wed Apr 01 2015 18:12:00 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
334+
on Fri Apr 03 2015 11:48:43 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
335335
</span>
336336
</footer>
337337
</div>

doc/classes.list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ <h3 class="subsection-title">Classes</h3>
163163

164164
<span class="jsdoc-message">
165165
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a>
166-
on Wed Apr 01 2015 18:12:00 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
166+
on Fri Apr 03 2015 11:48:43 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
167167
</span>
168168
</footer>
169169
</div>

doc/index.html

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h1 id="introduction">Introduction</h1>
9090
<h2 id="features">Features</h2>
9191
<ul>
9292
<li>Incremental data update: replacing polling by push is not enough to minimize data streams. That&#39;s why streamdata.io pushes only the part that has changed.</li>
93-
<li><a href="http://www.w3.org/TR/eventsource/" target="_blank">Server Sent Events (SSE)</a>: updates are pushed to the client using SSE protocol. By providing fallback mechanisms streamdata.io can also work with older browsers.</li>
93+
<li><a href="http://www.w3.org/TR/eventsource/" target="_blank">Server-Sent-Events (SSE)</a>: updates are pushed to the client using SSE protocol. By providing fallback mechanisms streamdata.io can also work with older browsers.</li>
9494
<li>API Cache: to reduce server load and latency, streamdata.io has an integrated cache mechanism.</li>
9595
</ul>
9696
<p>This Javascript SDK facilitates the usage of streamdata.io.</p>
@@ -101,12 +101,12 @@ <h2 id="1-add-sdk-to-your-application">1. Add SDK to your application</h2>
101101
<pre><code class="lang-html">&lt;script src=&quot;/js/streamdataio.min.js&quot;&gt;&lt;/script&gt;
102102
</code></pre>
103103
<p>By doing this, you access in your JavaScript code to the <code>streamdataio</code> object which is the central point of all streamdata.io SDK API.</p>
104-
<h2 id="2-create-a-streamdataeventsource-object">2. Create a StreamDataEventSource Object</h2>
104+
<h2 id="2-use-streamdata-io-to-connect-to-your-api">2. Use streamdata.io to connect to your API</h2>
105105
<p>Create a <code>StreamDataEventSource</code> object into your JavaScript code.</p>
106106
<pre><code class="lang-javascript"> var myEventSource = streamdataio.createEventSource(&quot;http://mysite.com/myJsonRestService&quot;);
107107
</code></pre>
108108
<p>The <code>StreamDataEventSource</code> is the main entry point for establishing a data stream connection to the given URL. </p>
109-
<p>It uses standard HTTP Server Sent Events to get the data you required through streamdata.io proxy.</p>
109+
<p>It uses standard HTTP Server-Sent-Events to get the data you required through streamdata.io proxy.</p>
110110
<p>If your API requires specific headers, simply pass them as an array on the event source creation, and streamdata.io will forward them to your Information System.</p>
111111
<p>An optional <code>headers</code> parameter can be passed to the <code>createEventSource</code> method. </p>
112112
<p>It must be an array with the following structure:</p>
@@ -121,32 +121,22 @@ <h2 id="2-create-a-streamdataeventsource-object">2. Create a StreamDataEventSour
121121

122122
var myEventSource = streamdataio.createEventSource(url, headers);
123123
</code></pre>
124-
<h2 id="3-add-callbacks-to-handle-data-reception">3. Add callbacks to handle data reception</h2>
124+
<h2 id="3-handle-data-reception">3. Handle data reception</h2>
125125
<p>streamdata.io SDK handles data from the targeted REST service as JSON objects.</p>
126126
<p>When the <code>StreamDataEventSource</code> object is opened, the initial set of data is returned as it would be with a standard call to the service URL. This data set is called the <strong>snapshot</strong>. The SDK returns it through the <code>onData</code> callback.</p>
127127
<p>The updates of this initial set will come subsequently in the <a href="http://tools.ietf.org/html/rfc6902" target="_blank">JSON-Patch</a> format through the <code>onPatch</code> callback. Such a data update is called a <strong>patch</strong>.</p>
128-
<h3 id="3-1-predefined-callback-method">3.1 Predefined callback method</h3>
129-
<pre><code class="lang-javascript"> var myDataCallback = function(data) {
130-
// do whatever you want with snapshot data
131-
// snapshot is provided by the sdk as a Json object
132-
};
133-
134-
var myPatchCallback =function(data) {
135-
// do whatever you want patch data
136-
// patch is provided by the sdk as a Json object
137-
};
138-
myEventSource.onData(myDataCallback);
139-
myEventSource.onPatch(myPatchCallback);
140-
</code></pre>
141-
<h3 id="3-2-direct-callback-definition">3.2 Direct callback definition</h3>
142-
<p>You can chain callback definitions and directly define callback functions</p>
128+
<p>You can define your callback functions as follows:</p>
143129
<pre><code class="lang-javascript"> myEventSource.onData(function(data){
144-
// do whatever you want with snapshot data
130+
// initialize your data with the initial snapshot
145131
}).onPatch(function(data){
146-
// do whatever you want with patch data
132+
// update the data with the provided patch
133+
}).onError(function(data){
134+
// do whatever you need in case of error
135+
}).onOpen(function(data){
136+
// you can also add custom behavior when the stream is opened
147137
});
148138
</code></pre>
149-
<h2 id="4-open-the-streamdataeventsource">4. Open the StreamDataEventSource</h2>
139+
<h2 id="4-start-receiving-data">4. Start receiving data</h2>
150140
<pre><code class="lang-javascript"> myEventSource.open();
151141
</code></pre>
152142
<h1 id="examples">Examples</h1>
@@ -209,21 +199,23 @@ <h2 id="1-simple-javascript-source-code-integration">1. Simple Javascript source
209199
</code></pre>
210200
<h2 id="2-example-projects">2. Example projects</h2>
211201
<p>You&#39;ll find on GitHub the following projects which integrates streamdata.io SDK within simple example applications.</p>
212-
<h3 id="jquery-example">jQuery example</h3>
202+
<h3 id="2-1-jquery-example">2.1 jQuery example</h3>
213203
<p>A simple jQuery integration of market data with streamdata.io SDK.</p>
214-
<p><a href="https://github.com/streamdataio/streamdataio-js/tree/master/stockmarket" target="_blank">Stock Market</a></p>
204+
<p><a href="https://github.com/streamdataio/streamdataio-js/tree/master/stockmarket-jquery" target="_blank">Stock Market jQuery</a></p>
215205
<h3 id="2-2-angular-js-example">2.2 Angular.js example</h3>
216206
<p>The same market data example using Angular.js </p>
217207
<p><a href="https://github.com/streamdataio/streamdataio-js/tree/master/stockmarket-angular" target="_blank">Stock Market Angular</a></p>
218-
<h3 id="2-2-twitter-example">2.2 Twitter example</h3>
208+
<h3 id="2-3-twitter-example">2.3 Twitter example</h3>
219209
<p>A sample to demonstrate how to integrate a twitter time line with streamdata.io SDK.</p>
220210
<p><a href="https://github.com/streamdataio/streamdataio-js/tree/master/twitter" target="_blank">Twitter</a></p>
221-
<h1 id="authentication">Authentication</h1>
211+
<h1 id="security">Security</h1>
212+
<h2 id="1-tls-encryption">1. TLS Encryption</h2>
213+
<p>streamdata.io uses Transport Layer Security (TLS) to encrypt messages while in transport across the Internet. Using TLS ensures that client messages are protected when being sent to and from streamdata.io. This prevents intercepted messages from being viewed by unauthorized parties.</p>
222214
<p>Running an application in production through streamdata.io proxy requires an authentication mechanism.</p>
223215
<p>When registering on <a href="http://streamdata.io" target="_blank">streamdata.io web site</a>, you&#39;ll be provided with a unique key pair for your application.</p>
224216
<p>This allows streamdata.io proxy to identify that a specific request comes from your application.</p>
225217
<p>This key pair must be provided to the SDK in order to be able to use the streamdata.io proxy.</p>
226-
<h2 id="1-provide-key-pair-in-source-code">1. Provide key pair in source code</h2>
218+
<h2 id="2-provide-key-pair-in-source-code">2. Provide key pair in source code</h2>
227219
<pre><code class="lang-javascript"> // setup key pair
228220
streamdataio.Pk = &quot;NmEtYTljN2UtYmM1MGZlMGRiNGFQzYS00MGRkLTkNTZlMDY1&quot;;
229221
streamdataio.pk = &quot;NTEtMTQxNiWIzMDEC00OWNlLThmNGYtY2ExMDJxO00NzNhLTgtZWY0MjOTc2YmUxODFiZDU1NmU0ZDAtYWU5NjYxMGYzNDdi&quot;;
@@ -237,7 +229,7 @@ <h2 id="1-provide-key-pair-in-source-code">1. Provide key pair in source code</h
237229
<p><strong>Important Note</strong>:</p>
238230
<p>You need to be aware that this method is useful for development purpose and tests but is not safe to go to production with.</p>
239231
<p>Your key pair must always be kept secret.</p>
240-
<h2 id="2-key-pair-external-storage">2. Key pair external storage</h2>
232+
<h2 id="3-key-pair-external-storage">3. Key pair external storage</h2>
241233
<p>You can store your key pair in a file using the following JSON format:</p>
242234
<pre><code class="lang-javascript"> {
243235
&quot;Pk&quot;: &quot;NTZlMDY1NmEtYTQzYS00MGRkLTljN2UtYmM1MGZlMGRiNGFk&quot;,
@@ -263,7 +255,7 @@ <h2 id="2-key-pair-external-storage">2. Key pair external storage</h2>
263255
<p><strong>Recommendation</strong>:</p>
264256
<p>We strongly recommend to always use https with applications using streamdata.io.</p>
265257
<p>This prevents any attacker from intercepting the data flow.</p>
266-
<h2 id="3-session-storage">3. Session storage</h2>
258+
<h2 id="4-session-storage">4. Session storage</h2>
267259
<p>You can activate/deactivate the storage of the key pair in the sessionStorage of your browser.</p>
268260
<p>This will prevent from querying the external storage each time you call <code>open</code> on your <code>StreamdataEventSource</code>.</p>
269261
<p>Use the <code>sessionStore</code> boolean attribute of the <code>streamdataio</code> object.</p>
@@ -392,7 +384,7 @@ <h2>
392384

393385
<span class="jsdoc-message">
394386
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a>
395-
on Wed Apr 01 2015 18:12:00 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
387+
on Fri Apr 03 2015 11:48:43 GMT+0200 (CEST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
396388
</span>
397389
</footer>
398390
</div>

0 commit comments

Comments
 (0)