|
@@ -85,12 +85,7 @@ class NchanDelegator extends ConfigPubsubDelegator {
|
|
|
*/
|
|
*/
|
|
|
addMessageHandler(handlable) {
|
|
addMessageHandler(handlable) {
|
|
|
super.addMessageHandler(handlable);
|
|
super.addMessageHandler(handlable);
|
|
|
-
|
|
|
|
|
- if (this.connection != null) {
|
|
|
|
|
- this.connection.on('message', (messageObj) => {
|
|
|
|
|
- this.handleMessage(messageObj, handlable);
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.registerMessageHandlerToConnection(handlable);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -101,6 +96,14 @@ class NchanDelegator extends ConfigPubsubDelegator {
|
|
|
this.subscribe(true);
|
|
this.subscribe(true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ registerMessageHandlerToConnection(handlable) {
|
|
|
|
|
+ if (this.connection != null) {
|
|
|
|
|
+ this.connection.on('message', (messageObj) => {
|
|
|
|
|
+ this.handleMessage(messageObj, handlable);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
constructUrl(basepath) {
|
|
constructUrl(basepath) {
|
|
|
const pathname = this.channelId == null
|
|
const pathname = this.channelId == null
|
|
|
? basepath // /pubsub
|
|
? basepath // /pubsub
|
|
@@ -132,7 +135,7 @@ class NchanDelegator extends ConfigPubsubDelegator {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// register all message handlers
|
|
// register all message handlers
|
|
|
- this.handlableList.forEach(handler => this.addMessageHandler(handler));
|
|
|
|
|
|
|
+ this.handlableList.forEach(handler => this.registerMessageHandlerToConnection(handler));
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.client = client;
|
|
this.client = client;
|