Skip to content

Commit

Permalink
docs(webSocket): fix node.js example, update examples (#2441)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsayol authored and benlesh committed Apr 3, 2017
1 parent 747bef6 commit 736d48d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/observable/dom/WebSocketSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,32 @@ export class WebSocketSubject<T> extends AnonymousSubject<T> {
*
* @example <caption>Wraps browser WebSocket</caption>
*
* let subject = Observable.webSocket('ws://localhost:8081');
* subject.subscribe(
* let socket$ = Observable.webSocket('ws://localhost:8081');
*
* socket$.subscribe(
* (msg) => console.log('message received: ' + msg),
* (err) => console.log(err),
* () => console.log('complete')
* );
* subject.next(JSON.stringify({ op: 'hello' }));
*
* socket$.next(JSON.stringify({ op: 'hello' }));
*
* @example <caption>Wraps WebSocket from nodejs-websocket (using node.js)</caption>
*
* import { w3cwebsocket } from 'websocket';
*
* let socket = new WebSocketSubject({
* let socket$ = Observable.webSocket({
* url: 'ws://localhost:8081',
* WebSocketCtor: w3cwebsocket
* });
*
* let subject = Observable.webSocket('ws://localhost:8081');
* subject.subscribe(
* socket$.subscribe(
* (msg) => console.log('message received: ' + msg),
* (err) => console.log(err),
* () => console.log('complete')
* );
* subject.next(JSON.stringify({ op: 'hello' }));
*
* socket$.next(JSON.stringify({ op: 'hello' }));
*
* @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object
* @return {WebSocketSubject}
Expand Down

0 comments on commit 736d48d

Please sign in to comment.