Closed advancedlogic closed 8 years ago
Hi @advancedlogic can you share the steps you tried?
math.go:
package main
import "github.com/koding/kite"
func main() {
// Create a kite
k := kite.New("math", "1.0.0")
k.SetLogLevel(kite.DEBUG)
// Add our handler method with the name "square"
k.HandleFunc("square", func(r *kite.Request) (interface{}, error) {
a := r.Args.One().MustFloat64()
result := a * a // calculate the square
return result, nil // send back the result
}).DisableAuthentication()
// Attach to a server with port 3636 and run it
k.Config.Port = 3636
k.Run()
}
exp2.go:
package main
import (
"fmt"
"github.com/koding/kite"
)
func main() {
k := kite.New("exp2", "1.0.0")
k.SetLogLevel(kite.DEBUG)
// Connect to our math kite
mathWorker := k.NewClient("http://localhost:3636/kite")
mathWorker.Dial()
response, _ := mathWorker.Tell("square", 4) // call "square" method with argument 4
fmt.Println("result:", response.MustFloat64())
}
./exp2 OUTPUT:
2016-03-14 21:15:58 [exp2] DEBUG Dialing '' kite: http://localhost:3636/kite 2016-03-14 21:15:58 [exp2] DEBUG Client transport is set to 'WebSocket' 2016-03-14 21:15:58 [exp2] DEBUG Sending: {"method":"square","arguments":[{"kite":{"name":"exp2","username":"unknown","id":"dd5ba302-19b5-4172-962a-68bb0fab8211","environment":"unknown","region":"unknown","version":"1.0.0","hostname":"Eliza"},"authentication":null,"responseCallback":"[Function]","withArgs":[4]}],"callbacks":{}}
./exp2 is hanging waiting for ./math to reply
./math OUTPUT:
2016-03-14 21:15:51 [math] INFO New listening: 0.0.0.0:3636 2016-03-14 21:15:51 [math] INFO Serving... 2016-03-14 21:15:58 [math] DEBUG New session: 3rd-cFOM_KZ85OWFnR0N 2016-03-14 21:15:58 [math] DEBUG Received : {"method":"square","arguments":[{"kite":{"name":"exp2","username":"unknown","id":"dd5ba302-19b5-4172-962a-68bb0fab8211","environment":"unknown","region":"unknown","version":"1.0.0","hostname":"Eliza"},"authentication":null,"responseCallback":"[Function]","withArgs":[4]}],"callbacks":{}} 2016-03-14 21:15:58 [math] DEBUG Session "3rd-cFOM_KZ85OWFnR0N" is identified as "/unknown/unknown/exp2/1.0.0/unknown/Eliza.homenet.telecomitalia.it/dd5ba302-19b5-4172-962a-68bb0fab8211"
any chance you can investigate the issue (if any) and fix it. I am in the process of starting an important project and I like the simplicity of your solution.
reason is https://golang.org/doc/go1.6#reflect
will update about the possible mitigation steps
In the meantime I will build it with go 1.5 Thanks
hi, any update for go 1.6? Thanks
Hi @advancedlogic fixing our stuff for go1.6 requires some work on our end and it is in low priority tasks. But we would be glad if you can contribute to kite.
The problem lies in the dnode package where we are "scrubbing" and "unscrubbing" the calls.
Tried your demo example but client blocks waiting for the server to send back an answer. Communication between client and server is in place but sounds like the server is not returning the result (square) to the client and the client is hanging. (go 1.6)