Simple example that implements the CLI prompt as input message to broadcast to all members into the network.
This example allows to the use to execute a gop2p.Node
:
-
Start the
cli-chat
:$ go run example/cli-chat/main.go
-
Connect to a other peer using the command
connect <port>
:$ go run example/cli-chat/main.go [INFO] started on http://localhost:61731 connect 53214
-
Broadcast a message typing the content and pressing enter:
$ go run example/cli-chat/main.go [INFO] started on http://localhost:61731 connect 53214 hello world
-
Disconnect from the network with the command
disconnect
(you can connect again repeating the from step 1):$ go run example/cli-chat/main.go [INFO] started on http://localhost:61731 connect 53214 hello world disconnect
-
Exit from the
cli-chat
with the commandexit
:$ go run example/cli-chat/main.go [INFO] started on http://localhost:61731 connect 53214 hello world disconnect exit $