Check connectivity before sending messages
Use LuaSocket's base 64 encoding function