gotalk icon indicating copy to clipboard operation
gotalk copied to clipboard

Gotalk connection close is called after 30 seconds

Open berk-can opened this issue 4 years ago • 0 comments

Hi everyone, I have server side

gotalk.Handle("connect", func(req model.SubscribeMachineReq) (model.SubscribeMachineReq, error) {
		log.Println("connect received")
		return req, nil
	})
	if err := gotalk.Serve("tcp", "localhost:1234",func (s *gotalk.Sock){}); err != nil {
		log.Println(err.Error())
	}

as well as client side

sock, err := gotalk.Connect("tcp", "localhost:1234")
	if err != nil {
		log.Println("Couldnt connect to streamer 1")
		time.Sleep(time.Second * 10)
		return
	}
	log.Println("Connected to streamer")
	sock.CloseHandler = func(socket *gotalk.Sock, code int) {
		Socket=nil
		log.Println(fmt.Sprintf("Streamer connection is broken with code:%d, retrying...",code))
		time.Sleep(time.Second * 10)
	}

The function I've set as CloseHandler is called after exacly 30 seconds of connection, why is that?

berk-can avatar Sep 28 '21 20:09 berk-can