summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-15 14:06:48 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-15 14:06:56 +0100
commit5ac87292c4810d816f16b1d2dd6a0dac643812e5 (patch)
treec858636626c9cd17407a7d4e103a8c487cd6f9c6 /webclient/components
parentEvent streaming now happens on an app level, rather than a per-room level. Ma... (diff)
downloadsynapse-5ac87292c4810d816f16b1d2dd6a0dac643812e5.tar.xz
Remove old polling stuff from RoomController. Added service comments. Do not start the event stream on startup unless you have credentials.
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/event-stream-service.js9
-rw-r--r--webclient/components/matrix/matrix-service.js12
2 files changed, 17 insertions, 4 deletions
diff --git a/webclient/components/matrix/event-stream-service.js b/webclient/components/matrix/event-stream-service.js
index 97018df881..9f678e8454 100644
--- a/webclient/components/matrix/event-stream-service.js
+++ b/webclient/components/matrix/event-stream-service.js
@@ -17,9 +17,10 @@ limitations under the License.
 'use strict';
 
 /*
-This service manages where in the event stream the web client currently is and 
-provides methods to resume/pause/stop the event stream. This service is not
-responsible for parsing event data. For that, see the eventHandlerService.
+This service manages where in the event stream the web client currently is,
+repolling the event stream, and provides methods to resume/pause/stop the event 
+stream. This service is not responsible for parsing event data. For that, see 
+the eventHandlerService.
 */
 angular.module('eventStreamService', [])
 .factory('eventStreamService', ['$q', '$timeout', 'matrixService', 'eventHandlerService', function($q, $timeout, matrixService, eventHandlerService) {
@@ -39,7 +40,7 @@ angular.module('eventStreamService', [])
     // interrupts the stream. Only valid if there is a stream conneciton 
     // open.
     var interrupt = function(shouldPoll) {
-        console.log("p[EventStream] interrupt("+shouldPoll+") "+
+        console.log("[EventStream] interrupt("+shouldPoll+") "+
                     JSON.stringify(settings));
         settings.shouldPoll = shouldPoll;
         settings.isActive = false;
diff --git a/webclient/components/matrix/matrix-service.js b/webclient/components/matrix/matrix-service.js
index 0a2d8005b6..0cc85db28e 100644
--- a/webclient/components/matrix/matrix-service.js
+++ b/webclient/components/matrix/matrix-service.js
@@ -16,6 +16,12 @@ limitations under the License.
 
 'use strict';
 
+/*
+This service wraps up Matrix API calls. 
+
+This serves to isolate the caller from changes to the underlying url paths, as
+well as attach common params (e.g. access_token) to requests.
+*/
 angular.module('matrixService', [])
 .factory('matrixService', ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {
         
@@ -36,10 +42,16 @@ angular.module('matrixService', [])
     var MAPPING_PREFIX = "alias_for_";
 
     var doRequest = function(method, path, params, data) {
+        if (!config) {
+            console.warn("No config exists. Cannot perform request to "+path);
+            return;
+        }
+    
         // Inject the access token
         if (!params) {
             params = {};
         }
+        
         params.access_token = config.access_token;
         
         return doBaseRequest(config.homeserver, method, path, params, data, undefined);