A chat with nowjs or socket.io is one of the easiest exercises you can perform with them. I want to implement a multi-room chat (with a non-fixed number of rooms and logged user
Man-in-the-middle is certainly a consideration. The biggest security issue, though, would be XSS.
This useful SO thread suggests:
This very informative article suggests:
This useful thread says to set secure:true on socket.io.connect(...)
I'd recommend taking all those suggestions :)