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

chore: update network setup documentation for SSL and non-SSL usage #263

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions v4-client-py-v2/documentation/network_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,38 @@ Or provide the URL directly to the client, e.g.:
```python
indexer = IndexerClient("https://dydx-testnet.imperator.co")
```

#### Using Non-SSL Connections
The SDK supports both secure (SSL) and insecure (non-SSL) connections. By default, secure connections are used. However, for scenarios where you need to use a non-SSL node (e.g., local development), you can use the make_insecure function:

###### Create a secure version of the testnet configuration
```
from functools import partial

make_testnet_secure = partial(
make_secure,
testnet_node,
rest_indexer="SECURE_REST_INDEXER_URL",
websocket_indexer="SECURE_WEBSOCKET_INDEXER_URL",
node_url="SECURE_NODE_URL",
)
TESTNET_SECURE = make_testnet_secure()
```

###### Create an insecure version of the testnet configuration
```
from functools import partial

make_testnet_insecure = partial(
make_insecure,
testnet_node,
rest_indexer="INSECURE_REST_INDEXER_URL",
websocket_indexer="INSECURE_WEBSOCKET_INDEXER_URL",
node_url="INSECURE_NODE_URL",
)
TESTNET_INSECURE = make_testnet_insecure()
```
The difference between `make_secure` and `make_insecure` lies in the type of gRPC channel they use:

- `make_secure`: This function uses `secure_channel`, which creates an SSL-encrypted connection. It's suitable for production environments and when connecting to nodes over public networks.
- `make_insecure`: This function uses `insecure_channel`, which creates a non-SSL connection. It's typically used for local development or in trusted network environments where encryption isn't necessary.
Loading