Add handler for socket connection