mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
set demos as console scripts, update chat instructions
This commit is contained in:
@ -1,17 +1,32 @@
|
||||
Echo Demo
|
||||
=========
|
||||
|
||||
Copy the code below into a file called ``demo.py``.
|
||||
Install dependencies, preferably in a virtual environment, with:
|
||||
This example demonstrates a simple ``echo`` protocol.
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
python -m pip install libp2p
|
||||
$ python -m pip install libp2p
|
||||
Collecting libp2p
|
||||
...
|
||||
Successfully installed libp2p-x.x.x
|
||||
$ echo-demo
|
||||
Run this from the same folder in another console:
|
||||
|
||||
Run the demo with ``python echo.py`` and copy the output.
|
||||
echo-demo -p 8001 -d /ip4/127.0.0.1/tcp/8000/p2p/16Uiu2HAmAsbxRR1HiGJRNVPQLNMeNsBCsXT3rDjoYBQzgzNpM5mJ
|
||||
|
||||
Open a second terminal, navigate to the folder that contains ``echo.py``, then paste
|
||||
and run the copied line.
|
||||
Waiting for incoming connection...
|
||||
|
||||
Copy the line that starts with ``echo-demo -p 8001``, open a new terminal in the same
|
||||
folder and paste it in:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ echo-demo -p 8001 -d /ip4/127.0.0.1/tcp/8000/p2p/16Uiu2HAmAsbxRR1HiGJRNVPQLNMeNsBCsXT3rDjoYBQzgzNpM5mJ
|
||||
|
||||
I am 16Uiu2HAmE3N7KauPTmHddYPsbMcBp2C6XAmprELX3YcFEN9iXiBu
|
||||
Sent: hi, there!
|
||||
|
||||
Got: hi, there!
|
||||
|
||||
.. literalinclude:: ../examples/echo/echo.py
|
||||
:language: python
|
||||
|
||||
Reference in New Issue
Block a user