1. Update device var every time via websocket
2. Refactored app.js