dappEngine

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StartEngine = cli.Command{
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:        "dev-server",
			Destination: &devServerAddr,
		},
	},
	Name: "engine:start",
	Action: func(c *cli.Context) error {

		h, err := lp2p.New(context.Background(), lp2p.Defaults, config)
		if err != nil {
			panic(err)
		}

		addr, err := ma.NewMultiaddr(devServerAddr)
		if err != nil {
			fmt.Println(err)
			return nil
		}

		client := &DAppClient{}

		registry := reg.NewDAppRegistry(h, client)

		client.startDApp = func(dApp dapp.JsonRepresentation) error {
			return registry.StartDApp(&dApp)
		}

		if err := registry.ConnectDevelopmentServer(addr); err != nil {
			panic(err)
		}

		fmt.Println("started engine")

		http.HandleFunc("/ws", wsHandler)

		go func() {
			err := http.ListenAndServe(":4839", nil)
			if err != nil {
				panic(err)
			}
		}()

		select {}

		return nil
	},
}

Functions

This section is empty.

Types

type DAppClient

type DAppClient struct {
	// contains filtered or unexported fields
}

func (*DAppClient) HandleReceivedDApp

func (c *DAppClient) HandleReceivedDApp(dApp dapp.JsonRepresentation) error

func (*DAppClient) Render

func (c *DAppClient) Render(jsxJson string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL