I believe this has been asked before but never found anything related to stateful connections, So here it goes.
I'm writting a server in golang where users connect and login to ask for specific date later on. My problem here is that doing my research I came up with a method of archiving this over a tcp connection (lets remember it's stateful) creating a goroutine every connection and keeping it listening to the user income like this example: https://github.com/firstrow/tcp_server/blob/master/tcp_server.go My doubts with this method are related with the idea of keeping a goroutine openned for every connected user.
I would like to know if this is the correct approach or if there is another method to archieve that like keeping a less amount of routines listning for new incomes.
Thanks