Example #1
0
File: main.go Project: conas/tno2
//Basic low level wotServer setup
func main() {
	//WoT server defines implements interaction with device
	wotServer := server.CreateFromDescriptionUri(model)
	setupWotServer(wotServer)

	//Frontend is transport implementation
	feCfg := col.AsMap([]*col.KeyValue{col.KV("port", 8080)})
	fe := frontend.NewHTTP(feCfg)
	fe.Bind("/01-basic-example", wotServer)
	fe.Start()
}
Example #2
0
func (p *Platform) AddWotServer(id, wotDescURI, ctxPath, beEncID, beID string, feIDs []string) {
	wotServer := server.CreateFromDescriptionUri(wotDescURI)
	p.wots[id] = wotServer
	be, _ := p.backends[beID]
	encoder, error := backend.Encoders.Get(beEncID)

	if error != nil {
		panic(error)
	}

	be.Bind(wotServer, ctxPath, encoder)

	for _, feId := range feIDs {
		frontend, _ := p.frontends[feId]
		frontend.Bind(ctxPath, wotServer)
	}
}