title: How to send WebSocketSubject messages only from client to server?
body: <p>I created an observable for my websocket connection using WebSocketSubject from rxjs. So far so good the server-client communication is working. Now the thing is: I can't distinguish between the origins of the message in my client. I send messages by calling next() on the subject. All subscriptions on the client get those messages too. How can I send messages only to the server instead?</p>
  
  <p>The implementation mainly stems from this article: <a href="https://medium.com/factory-mind/angular-websocket-node-31f421c753ff" rel="nofollow noreferrer">https://medium.com/factory-mind/angular-websocket-node-31f421c753ff</a></p>
  
  <p>My code:</p>
  
  <pre><code>socket$: WebSocketSubject&lt;any&gt;;
  
  constructor() {
    this.socket$ = WebSocketSubject.create(SOCKET_URL);
  
    this.socket$.subscribe(
      (message) =&gt; console.log('&lt;-- ' + message),
      (err) =&gt; console.error('Error on WebSocket:', err),
      () =&gt; console.warn('Completed!')
     );
  }
  
  send(message: SocketMessage) {
    const tmp: any = {};
    tmp.type = message.type;
    tmp.payload = message.payload;
    // This will be received by the server but also by client subscriptions = bad
    this.socket$.next(JSON.stringify(tmp));
  }
  </code></pre>