title: WebSocketSubject - Advantage?
body: <p>Disclaimer: I'm new to web development so bear with me...</p>
  
  <p>Stack: Angular front-end, Tornado (python-based) web server for back end</p>
  
  <p>I've been using RxJs and WebSocket successfully to communicate with the backend, based on this very popular tutorial:  <a href="https://medium.com/@lwojciechowski/websockets-with-angular2-and-rxjs-8b6c5be02fac" rel="nofollow noreferrer">https://medium.com/@lwojciechowski/websockets-with-angular2-and-rxjs-8b6c5be02fac</a></p>
  
  <p>I've just stumbled on WebSocketSubject in RxJs 5 and I'm wondering what the advantages are?  </p>
  
  <p>So far, I've been able to use it to connect, send and receive, but I can't figure out how to use the typical RxJs operators that I get with a Subject... so in a way it just seems harder to use.  </p>
  
  <p>What am I missing?  </p>
  
  <p>Here's the code I'm working with:</p>
  
  <pre><code>  //create the socket
    this.pubsubSubject = WebSocketSubject.create("ws://" + this.hostName + ":" + connection_info.port + "/" + connection_info.ps);
  
    //output a message when it's open
    this.pubsubSubject.openObserver = {
      next: value =&gt; {
        console.log("ps socket is " + (this.pubsubSubject.socket.readyState == WebSocket.OPEN ? "OPEN" : "NOT OPEN"));
      }
    }
  
    //send the authentication token through the socket
    this.pubsubSubject.next(JSON.stringify(authenticate_request));
  
  //subscribe to specific events from server
  var subscription = {
    "subscribe": events
  }
  this.pubsubSubject.next(JSON.stringify(subscription));
  
  //start getting messages
  this.pubsubSubject.subscribe(
    (msg: any) =&gt; {
      console.log("msg: " + msg);
    }
  )
  </code></pre>