Can a single thing have multiple connection, if so can all of them be active at the same time?
I'm exploring the eclipse ditto recently and I wanted to know whether below given approach is correct for finding the connection a 'thing' uses. I'm trying to get the connection a 'thing' uses, by mapping the thing-policy's authorization subject with authorization context of connections.
const matchingSourceConnection = connections.filter((connection) => {
return (
connection.sources &&
connection.sources[0].authorizationContext &&
connection.sources[0].authorizationContext.some((context) => authorizationSubjects.includes(context))
);
});
Thank you!
This code checks each source in every connection, which can provide a more comprehensive match.