0

I am new to cryptocurrencies in general and I am at an intermediate level in Python (but a new Websocket user). I am using the xrpl-py library in order to build a Ripple-ledger based App, however I am getting stuck at the very beginning.

When I try to run the following

testnet_url = "https://s.altnet.rippletest.net:51234"

from xrpl.clients import WebsocketClient

client = WebsocketClient(testnet_url)
client.open()    #This usage for opening the client is not preferred, but is useful for reproducing the error

I get the following error:

File "/home/gordito/anaconda3/lib/python3.7/site-packages/websockets/uri.py", line 70, in parse_uri raise InvalidURI(uri) from exc

InvalidURI: https://s.altnet.rippletest.net:51234 isn't a valid URI

Am I trying to connect to the wrong url? This is the only address listed in the XRP documentation.

Thanks.

Progman
  • 16,827
  • 6
  • 33
  • 48

2 Answers2

1

if you connect to a websocket, the URL should start with wss:// and not https://.

A list of public endpoints to connect to can be found here:

https://xrpl.org/public-servers.html

so in your example, the URL should be:

wss://s.altnet.rippletest.net/

if you use https:// then you call the JSON-RPC endpoint and not the websocket endpoint.

Best, Daniel

nixer
  • 46
  • 3
0

I'm learning to connect to the test net like this, using JavaScript:

const api = new xrpl.Client("wss://s.altnet.rippletest.net/");
This Pimp
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 25 '22 at 14:35