Indeed, I was going to mention the ChatApp example from Nim in Action. Pretty sure it implements precisely what you're trying to implement.
See both server and client here: [https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp](https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp)