nimiq / electrum-client

API to interact with ElectrumX servers from browsers
14 stars 9 forks source link

Websocket connection fails #4

Open fbwoolf opened 2 years ago

fbwoolf commented 2 years ago

If I'm trying to use ElectrumClient in my project and the websocket connection fails, what am I missing?

sisou commented 2 years ago

Hi! Are you using any special config? Special seed nodes? Or just the defaults?

ElectrumX servers don't accept websockets by default, it needs to be enabled in their config. If you are only using the public ElectrumX servers on the internet, none of them typically have websockets enabled. So all communication from this client needs to go through a WS-to-TCP proxy. This library is built for the Websockify proxy. More detailed explainer here: https://github.com/nimiq/electrum-client#websockify

If you can share any more details about your configuration and where you are running this client, I can maybe help better.

sisou commented 2 years ago

I just pushed a fix that also fixes the example in this repository. Please pull the latest commits on the master branch and follow the instructions in the ./example folder: https://github.com/nimiq/electrum-client/tree/master/example#readme