Closed salocinx closed 4 years ago
Hi @salocinx ,
Can you double-check? I just tried executing your code example and it seems to work fine:
It did take a few seconds to connect, but connected nonetheless.
Also, Nicolas, note that ETH-USD
fiat market doesn't exist on Sandbox (and consequently, no heartbeat for ETH-USD
). Try using BTC-USD
for Sandbox if you're looking for a heartbeat
. The ETH-USD
fiat market you're looking for only exists on Production (currently).
Products API on Sandbox: https://api-public.sandbox.pro.coinbase.com/products
{
"id": "LINK-USDC",
"base_currency": "LINK",
"quote_currency": "USDC",
...
},
{
"id": "BAT-USDC",
"base_currency": "BAT",
"quote_currency": "USDC",
...
},
{
"id": "ETH-BTC",
"base_currency": "ETH",
"quote_currency": "BTC",
...
},
{
"id": "BTC-USD",
"base_currency": "BTC",
"quote_currency": "USD",
...
},
{
"id": "BTC-GBP",
"base_currency": "BTC",
"quote_currency": "GBP",
...
},
{
"id": "BTC-EUR",
"base_currency": "BTC",
"quote_currency": "EUR",
...
}
]
Changing the product ID to the BTC-USD
market on Sandbox shows a heartbeat
:
Let me know if you continue to have issues.
Thanks, Brian
Hi Brian
Thank you very much for your detailed answer! I still cannot connect when using the NuGet package 2.0.6. My sample program never outputs [OK]
, which means that await socket.ConnectAsync();
never returns. I meanwhile also tried to turn off all firewalls from Windows and make sure the web service isn't blocked by the router's firewall as well.
However, I now cloned your master branch and imported my sample program there and it works exactly like you describe in your answer (getting heartbeat messages for BTC-USD
on sandbox).
Is there any difference between the NuGet package 2.0.6 and the current master branch on GitHub?
Thanks for your support! Nicolas
Hi Nicolas,
No there shouldn't be any functional difference between v2.0.6
on NuGet and the master
branch here.
The only thing I can think of that might make a difference is that:
You'd want to make sure that your project is binding to the correct TFM. If you open the NuGet package with a zip utility, you should have 2 folders:
One is a build for .NET Framework 4.5 and the other is for .NET Standard 2.0. You'll want to check that you're program is linked to and using the correct TFM.
Also, try deleting any /bin
and /obj
folders; and then recompiling.
It's hard to tell what exactly is going on without more diagnostic information from your machine. If you'd like more help, please provide:
.EnableFiddlerDebugProxy()
? If so, do you see any errors? More info here: https://github.com/bchavez/Coinbase/wiki/Debugging-with-FiddlerThanks, Brian
Hi Brian
I meanwhile did some more testing. I am using Windows 10, Visual Studio 2019 and I have .NET Framework 4.8 installed. You have been pointing to the right direction. The connection problem only occurs when working with a .NET Framework
as TFM
. When using the same code I posted above using .NET Core 3.1
as TFM
, connecting to the web feed works fine.
Could you please re-check if the program posted above works with .NET Framework 4.8
as TFM
on your side? If it works, I will provide detailed network records and more information in order to pinpoint the issue.
Thanks for your ongoing support!
Hi @salocinx, I took a second look at this and was able to reproduce the issue. The problem is, the event that fires .Opened
event is the main thread for WebSocket4Net
and messages won't be processed when the tread blocks at .ReadLine()
. So it's like we stole the thread from WebSocket4Net
and it never processes messages again.
I'm going to try to fix the bug and release a new version with a possible bug fix.
Hi @salocinx
Please try v3.0.1
I think I've included some fixes that might help your situation on .NET Full Framework.
https://www.nuget.org/packages/Coinbase.Pro/3.0.1
Hi
Thanks for sharing your work! I am currently trying to connect to the websocket feed. But
await socket.ConnectAsync();
never returns and I get not connected. I have double checked the webservice atwss://ws-feed-public.sandbox.pro.coinbase.com
on www.websocket.org and the webservice itself seems to be working fine.Here's my testing code:
The code line
Console.WriteLine("[OK]");
is never executed. The program hangs atawait socket.ConnectAsync();
infinitely.Some idea how to solve this issue?