Commits

Michael P. Jung committed 6c451c1

Convert topic to string for pattern matching

Comments (0)

Files changed (1)

opoge/pusher/static/consumer.js

 	Consumer.prototype.processMessage = function(message) {
 		var topic = message[0];
 		var data = message[1];
-		if (this.subscribers == null) {
-			throw new Error("Foo");
-		}
+		// XXX Should we really mangle the topic to a string just
+		//     for matching with regular expressions?
+		var topicString = topic.toString();
 		for (var i=0; i<this.subscribers.length; ++i) {
 			var subscriber = this.subscribers[i];
-			if (topic.match(subscriber.topicRegExp)) {
+			if (topicString.match(subscriber.topicRegExp)) {
 				subscriber.callback(topic, data);
 			}
 		}