update main.js to render frame on receiving the data instead of own loop