title: How to request data with Angular RXJS Websockets from Bitvavo
body: <p>I'm learning about angular and can't figure out how to use RXJS websockets to send messages for data requests with the Bitvavo servers. <a href="https://docs.bitvavo.com/#tag/Websocket" rel="nofollow noreferrer">https://docs.bitvavo.com/#tag/Websocket</a></p>
  <p>The connection is established (see last picture), but I don't know how to request data with this message:</p>
  <pre><code>{&quot;action&quot;:&quot;subscribe&quot;,&quot;channels&quot;:[{&quot;name&quot;:&quot;candles&quot;,&quot;interval&quot;:[&quot;1h&quot;],&quot;markets&quot;:[&quot;BTC-EUR&quot;]},{&quot;name&quot;:&quot;book&quot;,&quot;markets&quot;:[&quot;BTC-EUR&quot;,&quot;XRP-EUR&quot;]}]}
  </code></pre>
  <p>If anyone could provide an example of how to get the data from bitVavo/ or any other server, and how to use this data in HTML, that would be much appreciated.</p>
  <p>api url: <code>wss://ws.bitvavo.com/v2</code></p>
  <p>Service:</p>
  <pre><code>  public subject  = webSocket(Variables.BitvavoWssApiUrl);
    public messages$ = this.subject.asObservable();
  
    sendMessage(msg: string) {
      this.subject.next(msg);
    }
  </code></pre>
  <p>Component:</p>
  <pre><code>this.BitVavoService.subject.subscribe(
    msg =&gt; console.log(msg), // Called whenever there is a message from the server.
    err =&gt; console.log(err), // Called if at any point WebSocket API signals some kind of error.
    () =&gt; console.log('complete') // Called when connection is closed (for whatever reason).
  );
  
  this.BitVavoService.sendMessage('{&quot;action&quot;:&quot;subscribe&quot;,&quot;channels&quot;:[{&quot;name&quot;:&quot;candles&quot;,&quot;interval&quot;:[&quot;1h&quot;],&quot;markets&quot;:[&quot;BTC-EUR&quot;]},{&quot;name&quot;:&quot;book&quot;,&quot;markets&quot;:[&quot;BTC-EUR&quot;,&quot;XRP-EUR&quot;]}]}');
  
  
  this.BitVavoService.sendMessage({&quot;action&quot;:&quot;subscribe&quot;,&quot;channels&quot;:[{&quot;name&quot;:&quot;candles&quot;,&quot;interval&quot;:[&quot;1h&quot;],&quot;markets&quot;:[&quot;BTC-EUR&quot;]},{&quot;name&quot;:&quot;book&quot;,&quot;markets&quot;:[&quot;BTC-EUR&quot;,&quot;XRP-EUR&quot;]}]});
  console.log(liveData$);
  </code></pre>
  <p>My firefox browser:
  <a href="https://i.stack.imgur.com/n8qlS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n8qlS.png" alt="enter image description here" /></a></p>
  <p>Postman:
  <a href="https://i.stack.imgur.com/pKzIx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pKzIx.png" alt="enter image description here" /></a></p>