client: move streaming code into app.js, it's not long enough already