Skip to content

Commit 4127398

Browse files
authored
Merge pull request #58 from jamaljsr/example-readme
example: add README with setup instructions
2 parents 8afcf3f + 15dc533 commit 4127398

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ secure LNC connection:
6262
embedded in a website (such as [Lightning
6363
Terminal](https://terminal.lightning.engineering/)) to communicate with a
6464
mailbox proxy over WebSockets using the PAKE/Noise encryption protocol. [An
65-
example HTML page](example/index.html) shows how the WASM binary can be used
65+
example HTML page](example/README.md) shows how the WASM binary can be used
6666
by JavaScript to initiate a connection and issue gRPC requests.
6767

example/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# LNC Example HTML Page
2+
3+
This folder contains an example HTML page with JS code used to demonstrate how
4+
to connect to a `litd` node using LNC on the web.
5+
6+
## Setup
7+
8+
Follow these steps to be able to view the example page in a browser on your
9+
machine.
10+
11+
1. Clone this repository
12+
```
13+
$ git clone git@github.com:lightninglabs/lightning-node-connect.git
14+
$ cd lightning-node-connect
15+
```
16+
1. Build the WASM binary
17+
```
18+
$ make wasm
19+
```
20+
1. Run the HTTP server which will make the HTML page and WASM binary accessible
21+
to your web browser
22+
```
23+
$ make example-server
24+
```
25+
1. Open [http://localhost:8080](http://localhost:8080) in a web browser to view
26+
the page
27+
28+
## Using the Example Page
29+
30+
Here's how to use the HTML page to connect to your `litd` node
31+
32+
1. Enter a namespace or use the default value. This value is used to group the
33+
data that is stored in your browser's `localStorage`. By using different
34+
namespaces, you can maintain connection information for multiple nodes in
35+
one browser. However, you can only connect to one node at a time.
36+
1. Click on the "Initiate the client" button.
37+
1. If you had previously connected using the specified namespace, it will
38+
attempt to automatically reconnect to your existing session.
39+
1. If you have not connected using the specified namespace, you will be
40+
prompted to enter your Pairing Phrase.
41+
1. Enter the Pairing Phrase that can be copied from your `litd` node's web UI.
42+
1. Keep the default mailbox server unless you used a custom server when
43+
creating the session in `litd`.
44+
1. Click on the "Connect to server" button to establish the LNC connection.
45+
1. A section of labels and buttons will be displayed allowing you to call
46+
many of the RPCs exposed by LND, Loop, Pool, and Faraday.
47+
1. Click on the first "GetInfo" button. The RPC response will be displayed
48+
above the LND label.

0 commit comments

Comments
 (0)