From 8bc423bde6cf21f01265905326ae78494e0755de Mon Sep 17 00:00:00 2001 From: Ryan Keys Date: Mon, 12 Apr 2021 11:37:15 -0700 Subject: [PATCH] Fixed WebsocketClient 'Failed to subscribe' While following the documentation on cbpro.Websocket's implementation, I came across the error: {'type': 'error', 'message': 'Failed to subscribe', 'reason': 'No channels provided'} In order to fix this error a parameter for self.channels is required. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37872be3..ccfcad83 100644 --- a/README.md +++ b/README.md @@ -261,7 +261,6 @@ If you would like to receive real-time market updates, you must subscribe to the ```python import cbpro -# Parameters are optional wsClient = cbpro.WebsocketClient(url="wss://ws-feed.pro.coinbase.com", products="BTC-USD", channels=["ticker"]) @@ -272,7 +271,7 @@ wsClient.close() #### Subscribe to multiple products ```python import cbpro -# Parameters are optional + wsClient = cbpro.WebsocketClient(url="wss://ws-feed.pro.coinbase.com", products=["BTC-USD", "ETH-USD"], channels=["ticker"]) @@ -318,6 +317,7 @@ class myWebsocketClient(cbpro.WebsocketClient): def on_open(self): self.url = "wss://ws-feed.pro.coinbase.com/" self.products = ["LTC-USD"] + self.channels = ["ticker"] self.message_count = 0 print("Lets count the messages!") def on_message(self, msg):