Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How exactly to integrate web sockets ? #96

Closed
WhiteBookmark opened this issue Jun 3, 2019 · 8 comments
Closed

How exactly to integrate web sockets ? #96

WhiteBookmark opened this issue Jun 3, 2019 · 8 comments

Comments

@WhiteBookmark
Copy link

WhiteBookmark commented Jun 3, 2019

I have succeeded in installing electrum and running it as a daemon, it also accepts bitcoin in my website through electrum-merchant but one thing I do not understand is that how exactly to integrate web sockets ?

I did read the docs but the only information there is how to connect to a web socket server, lets suppose I make my own, then what procedure should I follow next ? Sockets, events, verifying, count of confirmations etc all this stuff would be done by me through custom coding or electrum can do it by itself ?

Secondly I would like to request for electrum-merchant to display the wallet address on the index.html page when viewed, not everyone use QR code or bitcoin core wallet, this can help a lot.

Thanks

@ser
Copy link
Contributor

ser commented Jun 4, 2019

  1. I think you should read electrum docs first, including merchant chapter.
  2. We are planning to deliver other templates, but until they are ready, look at javscript part of index.html and just add address in there.

@WhiteBookmark
Copy link
Author

I have read it again and so far everything works fine except for the web socket part, which I don't understand what to do, there is not enough information on how to successfully implement the websockets. JSONRPC is working fine with curl, but I need a way to know whether or not the user has paid the invoice which can be done using sockets only.

@ser
Copy link
Contributor

ser commented Jun 6, 2019

Maybe this guide will be helpful, then? http://yz.mit.edu/wp/web-sockets-tutorial-with-simple-python-server/

@WhiteBookmark
Copy link
Author

Well that just shows hosting a simple socket server. You mean I just need to run an empty web socket server with nothing coded inside it and electrum will take care of everything by itself ?

@ser
Copy link
Contributor

ser commented Jun 6, 2019

If you followed electrum merchant docs, the simple socket server already works for you. The tutorial is useful to see how the javascript part is constructed.

@WhiteBookmark
Copy link
Author

WhiteBookmark commented Jun 7, 2019

I am not sure if it is actually working or I am not doing something right. I see this message in browser console when I test a payment request:

JQMIGRATE: Migrate is installed, version 3.0.1
index.html?id=5835f9a531:41 getJSON:success
index.html?id=5835f9a531:76 Opening WSS: wss://Server IP Address:7246/
index.html?id=5835f9a531:77
Cross-Origin Read Blocking (CORB) blocked cross-origin response http://Redirected Url Here/index.html with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
WebSocket connection to 'wss://Server IP Address:7246/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
(anonymous) @ index.html?id=5835f9a531:77

I also noticed that it is using "wss", I did not configure https, perhaps this could be the issue ? But why is it automatically using wss (https) model, I don't need it, is there any way to let it use ws instead of wss ?

@ser
Copy link
Contributor

ser commented Jun 7, 2019

You can't use electrum merchant without providing keys for SSL. It is clearly stated in requirements on the top of documentation chapter.

@ecdsa
Copy link
Member

ecdsa commented May 10, 2020

merchant documentation was updated for 4.0
websockets do not require an installation anymore

@ecdsa ecdsa closed this as completed May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants