func fibRequest(req *G.Request, resp *G.Message) { pack := map[string]float64{} req.Data(&pack) next := pack["first"] + pack["second"] fmt.Printf("First %.0f Second %.0f Next %.0f \n", pack["first"], pack["second"], next) resp.SetData(next) }
func converge(msg *G.Message) (*G.Message, error) { out := []*popular{} msg.GetData(&out) pWords := make([][]string, 3) for _, o := range out { pWords[o.WordLength-3] = o.Words } return G.NewMessage().SetData(pWords), nil }
func echoReply(req *G.Request, resp *G.Message) { var msg string req.Data(&msg) fmt.Println("Echoserver: received", msg) resp.SetData(fmt.Sprintf("Pong %v", msg)) }