Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

diffusion

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diffusion - npm Package Compare versions

Comparing version 5.7.5 to 5.7.6

src/node_modules/conversation/delegating-conversation-set.js

2

package.json
{
"name": "diffusion",
"version": "5.7.5",
"version": "5.7.6",
"description": "Diffusion Javascript UCI client",

@@ -5,0 +5,0 @@ "keywords" : ["diffusion", "reappt", "websockets", "data"],

@@ -29,5 +29,5 @@ var SessionImpl = require('session/session-impl');

*/
version : '5.7.5',
version : '5.7.6',
build : '5_dev#internal',
build : '6_01#39388',

@@ -34,0 +34,0 @@ /**

@@ -208,3 +208,5 @@ var Emitter = require('events/emitter');

log.info('Reconnected session');
conversationSet.replace(new Error("Peer is disconnected"));
log.info('Reconnected session, but messages may have been lost');
sessionActivityMonitor.onNewConnection(connection, response);

@@ -211,0 +213,0 @@ emitter.emit('reconnect');

@@ -263,3 +263,3 @@ var implements = require('util/interface').implements;

var conversations = internal.getConversationSet();
var cid = conversations.new(updateResponseHandler(internal, path, handler));
var cid = conversations.new(updateResponseHandler(internal, valueCache, path, handler));

@@ -266,0 +266,0 @@ if (internal.checkConnected(emitter)) {

@@ -17,4 +17,10 @@ var Services = require('services/services');

if (valueCache[topic]) {
var delta = datatype.deltaType().diff(valueCache[topic], value);
var deltaType = datatype.deltaType("binary");
var delta = deltaType.diff(valueCache[topic], value);
if (delta === deltaType.noChange()) {
callback(null, {});
return;
}
DELTA_SERVICE.send({

@@ -31,3 +37,5 @@ id : 0,

}
valueCache[topic] = value;
};
};

@@ -48,4 +48,4 @@ var implements = require('util/interface').implements;

self.on('unsubscribe', function(reason) {
e.emit('unsubscribe', reason);
self.on('unsubscribe', function(reason, topic) {
e.emit('unsubscribe', reason, topic);
});

@@ -52,0 +52,0 @@

var Services = require('services/services');
var DataTypes = require('data/datatypes');
var Emitter = require('events/emitter');

@@ -7,2 +7,8 @@ var Result = require('events/result');

var util = require('metadata/util');
function dataToBytes(d) {
return d.$buffer.slice(d.$offset, d.$length);
}
function Updater(cid, dispatch) {

@@ -24,3 +30,3 @@ var self = this;

} else {
dispatch(emitter, cid, topic, new Update.Update(value));
dispatch(emitter, cid, topic, value);
}

@@ -32,21 +38,55 @@

module.exports = function UpdateResponseHandler(internal, topic, handler) {
module.exports = function UpdateResponseHandler(internal, valueCache, topic, handler) {
var UPDATE_SOURCE_DEREGISTRATION = internal.getServiceLocator().obtain(Services.UPDATE_SOURCE_DEREGISTRATION);
var UPDATE_SOURCE_UPDATE = internal.getServiceLocator().obtain(Services.UPDATE_SOURCE_UPDATE);
var UPDATE_SOURCE_DELTA = internal.getServiceLocator().obtain(Services.UPDATE_SOURCE_DELTA);
var UPDATE_SOURCE_SET = internal.getServiceLocator().obtain(Services.UPDATE_SOURCE_SET);
var dispatch = function(emitter, cid, path, update) {
if (internal.checkConnected(emitter)) {
UPDATE_SOURCE_UPDATE.send({
cid : cid,
path : path,
update : update
}, function(err, result) {
if (err) {
emitter.error(err);
} else if (result.error) {
emitter.error(new Error("Topic update error for topic " + path + " : " + result.error));
var dispatch = function(emitter, cid, path, content) {
var callback = function(err, result) {
if (err) {
emitter.error(err);
} else if (result.error) {
emitter.error(new Error("Topic update error for topic " + path + " : " + result.error));
} else {
emitter.emit('complete');
}
};
if (internal.checkConnected(emitter)) {
if (util.isMetadataValue(content)) {
UPDATE_SOURCE_UPDATE.send({
cid : cid,
path : path,
update : new Update.Update(content)
}, callback);
} else {
var datatype = DataTypes.get(content);
var value = datatype.from(content);
if (valueCache[path]) {
var deltaType = datatype.deltaType("binary");
var delta = deltaType.diff(valueCache[path], value);
if (delta === deltaType.noChange()) {
callback(null, {});
return;
}
UPDATE_SOURCE_DELTA.send({
id : 0,
cid : cid,
path : path,
bytes : dataToBytes(delta)
}, callback);
} else {
emitter.emit('complete');
UPDATE_SOURCE_SET.send({
cid : cid,
path : path,
bytes : dataToBytes(value)
}, callback);
}
});
valueCache[path] = value;
}
}

@@ -53,0 +93,0 @@ };

@@ -188,2 +188,10 @@ var HashMap = require('hashmap');

serialisers.set(
require('services/topic-update/update-source-set-request'),
require('services/topic-update/update-source-set-request-serialiser')
);
serialisers.set(
require('services/topic-update/update-source-delta-request'),
require('services/topic-update/update-source-delta-request-serialiser')
);
serialisers.set(
require('services/missing-topic/missing-topic-request'),

@@ -190,0 +198,0 @@ require('services/missing-topic/missing-topic-request-serialiser')

@@ -33,2 +33,4 @@ var TopicSelector = require('../../selectors/topic-selector');

var UpdateSourceUpdate = require('services/topic-update/update-source-update');
var UpdateSourceSetRequest = require('services/topic-update/update-source-set-request');
var UpdateSourceDeltaRequest = require('services/topic-update/update-source-delta-request');
var UpdateSourceUpdateResponse = require('services/topic-update/update-source-update-response');

@@ -268,2 +270,14 @@ var UpdateSourceStateRequest = require('services/topic-update/update-source-state-request');

},
UPDATE_SOURCE_SET : {
id : 77,
name : "Update source set",
request : UpdateSourceSetRequest,
response : UpdateSourceUpdateResponse
},
UPDATE_SOURCE_DELTA : {
id : 78,
name : "Update source delta",
request : UpdateSourceDeltaRequest,
response : UpdateSourceUpdateResponse
},
UPDATE_TOPIC_SET : {

@@ -270,0 +284,0 @@ id : 79,

@@ -6,3 +6,3 @@ // Internal components

var ServiceRegistry = require('client/service-registry');
var ConversationSet = require('conversation/conversation-set');
var DelegatingConversationSet = require('conversation/delegating-conversation-set');
var ConnectionFactory = require('v4-stack/connection-factory');

@@ -28,3 +28,3 @@

var serviceRegistry = new ServiceRegistry();
var conversationSet = ConversationSet(function(cid, err) {
var conversationSet = new DelegatingConversationSet(function(cid, err) {
emitter.error(err);

@@ -31,0 +31,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc