Skip to content

Teonet proxy client server packages to connect golang wasm applications with Teonet peers.

License

Notifications You must be signed in to change notification settings

teonet-go/teoproxy

Repository files navigation

Teoproxy

Teonet proxy client server packages to connect golang wasm applications withTeonetpeers.

GoDoc Go Report Card

Teoproxy provides a websocket client server packages that can be used to connect wasm application with it own web server which runs Teonet and connects to teonet peers used in wasm application.

Getting started

There is main example in thecmd/teonet/fortune-guifolder. The example shows how to connect to Teonet peers with wasm application, and send and receive messages from wasm application to Teonet "fortune" peer.

There iscomplex Teonet examplewhich use mach teonet applications to get fortune messages from fortune teonet server. This teoproxy example do the same teonet function:

  • connect to Teonet
  • connect to Teonet "fortune" peer
  • connect to "fortune" api
  • request and receive "fortune" messages from Teonet server

To do this we use fyne-ios package to make simple gui application and teoproxy/teonet client and server packages to connect wasm application with Teonet peers.

Go tofortune-gui(cmd/teonet/fortune-gui) folder, and run native example:

go run main.go

To create web server for this application, go to thefortune-gui/serve(cmd/teonet/fortune-gui/serve) and execute next commands:

#Install fyne executible (if not installed)
go install fyne.io/fyne/v2/cmd/fyne@latest

#Build web package (or you can use `go generate` command to build
#and run this web server)
fyne package -os wasm --sourceDir../

#Run web server
go run.

By default web server runs onlocalhost:8081port. So you can open this url in your browser:http://localhost:8081and see the fortune-gui application in your browser.

There is preinstalled teofortune-gui web-app with namefortune-gui.teonet.dev

License

BSD