Closed chogarcia closed 9 years ago
Can you provide your controller javascript all of it?
perhaps you have subscribed 2 times (i get 2 updates per subscribe)
Yeah, actually I got 2 routers and 2 channels shared between the routers. Might be that the case?
As it was mentioned in another issue this is what onChannelMessage does: https://github.com/jonashagstedt/swampdragon/issues/3#issuecomment-58948948
// Here we handle messages on a channel from the server
// (notifications are received on a channel we subscribed to).
$dragon.onChannelMessage(function(channels, message) {
// We check if the channels we received from the server contains
// our local channel (SwampDragon keeps track on the clients side
// which server channels are mapped to which client channels)
if (indexOf.call(channels, myChannel) > -1) {
// We tell the data mapper to handle the data mapping
// for us so we don't have to loop over all the notifications
// to check if the notification is already in the list, if it has been updated
// or removed.
$scope.$apply(function() {
$scope.dataMapper.mapData(notifications, message);
});
}
});
The problem is that you have subscribed on the same channel twice, so you should check why you need to have two active subscriptions to both routers when you are sharing channels? Maybe some code will help to understand what you are trying to do.
Also from the documentation: If you are using a self-publishing model (SelfPublishModel), choose ModelRouter router, as the ModelPublisherRouter would issue two updates unless you override the updated function.
Sorry for my English.
Any clue why onChannelMessage is throwing 4 updated actions for the same object?