That will help me in the right direction, but unfortunately I'm not
entirely sure how to do this as documentation for LuaSocket isn't
exactly robust. If a user connects to the server, how do I keep track
of who is who? Where is their "user id" if it exists already?

On Thu, Dec 10, 2009 at 10:17 AM, Fabio Mascarenhas <mascaren...@acm.org> wrote:
> Well, you will need to keep a map of users to their connections
> (sockets) if you want to write a chat server (as well as sets of users
>  for each group). If you need to send a message to all users belonging
> to a specific group you do something like this:
>
> for _, user_id in ipairs(groups[group_id]) do
>  sockets[user_id]:send(msg)
> end
>
> This is really indepedent of Copas, Copas will just guarantee that if
> one of those sends blocks the other parts server will continue working
> instead of blocking too.

_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to