You are combining a number of things into one concept. Sockets is going to be specifically the network communication, the other areas of the chatroom are other topics entirely. However in the context of a chatroom I don't understand why you would need sockets at all. A quick Google search came up with this which might help:
http://www.tutorialized.com/tutorial...Chat-Systems/1