How can we deal with network events with our Lua socket APIs

We need to know about events happening - connections being made, disconnected etc.