Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(webSocket): fix node.js example #2441

Merged
merged 1 commit into from Apr 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/observable/dom/WebSocketSubject.ts
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