Event streaming now happens on an app level, rather than a per-room level. Make eventStreamService manage it's own repolling provided no one calls stop() on it. Couple the stream with eventHandlerService so any controller can just blithely call eventStreamService.resume() and expect to 'get stuff' without having to handle promises (though resume() still returns a promise for that request and proxies it through $q). Kill and reset the stream if you logout.

This commit is contained in:
Kegan Dougal 2014-08-15 13:43:07 +01:00
parent c51cf4efca
commit 7ddb7a5cbb
5 changed files with 76 additions and 19 deletions

View file

@ -119,7 +119,6 @@ angular.module('RoomController', [])
function(response) {
var member = $scope.members[chunk.target_user_id];
if (member !== undefined) {
console.log("Updated displayname "+chunk.target_user_id+" to " + response.data.displayname);
member.displayname = response.data.displayname;
}
}
@ -128,7 +127,6 @@ angular.module('RoomController', [])
function(response) {
var member = $scope.members[chunk.target_user_id];
if (member !== undefined) {
console.log("Updated image for "+chunk.target_user_id+" to " + response.data.avatar_url);
member.avatar_url = response.data.avatar_url;
}
}
@ -204,8 +202,6 @@ angular.module('RoomController', [])
matrixService.join($scope.room_id).then(
function() {
console.log("Joined room "+$scope.room_id);
// Now start reading from the stream
$timeout(shortPoll, 0);
// Get the current member list
matrixService.getMemberList($scope.room_id).then(