Code for event handling through sockets in Gorlang.