I can't seem to figure out this basic task. I'm attempting to create an Observable
from rxjx/observable/dom/webSocket
in RxJS5, but I'm not using typescript, or es6 modules... just plain 'ole good commonJS. Despite following the documentation and patching the Observable correctly, I keep encountering the error:
no WebSocket constructor can be found
, [source].
Although I haven't had the chance to delve into TypeScript yet, it seems like I've met all the constructor requirements, and reviewing the test spec where they use the function in the same way
Observable.webSocket('ws://host:port');
, I'm still encountering issues.
I've attempted:
var Rx = require('rxjs/Rx');
require('rxjs/Rx.dom').webSocketSubject; //also tried just using `.webSocket`
var source = Rx.Observable.webSocket('ws://localhost:53311');
source.subscribe();
I've also tried passing an object to Rx.Observable.webSocket
:
var source = Rx.Observable.webSocket({
url: 'ws://host:port'
});
Could someone assist me in understanding how to utilize the webSocket
Observable provided in rxjs5, especially when working with commonJS? (node v5.11)