Source
void subscribe(Map m) {
if (m['paths'] is List) {
for (Object p in m['paths']) {
String pathstr;
int qos = 0;
int sid = -1;
if (p is Map) {
if (p['path'] is String) {
pathstr = p['path'];
} else {
continue;
}
if (p['sid'] is int) {
sid = p['sid'];
} else {
continue;
}
if (p['qos'] is int) {
qos = p['qos'];
}
}
Path path = Path.getValidNodePath(pathstr);
if (path != null && path.isAbsolute) {
_getNode(path, (LocalNode node) {
_subscription.add(path.path, node, sid, qos);
closeResponse(m['rid']);
}, (e, stack) {
var error = new DSError(
"nodeError",
msg: e.toString(),
detail: stack.toString()
);
closeResponse(m['rid'], error: error);
});
} else {
closeResponse(m['rid']);
}
}
} else {
closeResponse(m['rid'], error: DSError.INVALID_PATHS);
}
}