Added security restriction, allowing only loggedin users to send messages