问题 Using gin framework. Is there anyway to notify client to close request connection, then server handler can do any back-ground jobs without letting the clients to wait on the connection? func Test(c *gin.Context) { c.String(200, "ok") // close client request, then do some jobs, for example sync data with remote server. // } 回答1: Yes, you can do that. By simply returning from the handler. And the background job you want to do, you should put that on a new goroutine. Note that the connection and