github.com/rolandhe/saber@v0.0.4/example/nfour/srv/serv.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/rolandhe/saber/nfour"
     5  	"github.com/rolandhe/saber/nfour/duplex"
     6  )
     7  
     8  func main() {
     9  	conf := nfour.NewSrvConf(func(task *nfour.Task) ([]byte, error) {
    10  		return []byte("echo:" + string(task.PayLoad)), nil
    11  	}, func(err error) []byte {
    12  		return []byte(err.Error())
    13  	}, 1000)
    14  
    15  	duplex.Startup(11011, conf)
    16  }