Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@coherentglobal/data-integration-lib
Advanced tools
Readme
postMessage
iFrame communication.Public (Minified) - https://data-integration-lib.s3.ap-southeast-1.amazonaws.com/index.min.js
Host: https://data-integration-lib.s3.ap-southeast-1.amazonaws.com/hub.html Client1: https://data-integration-lib.s3.ap-southeast-1.amazonaws.com/client1.html Client2: https://data-integration-lib.s3.ap-southeast-1.amazonaws.com/client2.html Client3: https://data-integration-lib.s3.ap-southeast-1.amazonaws.com/client3.html
All cross-domain local storage access is disabled by default with Safari 7+. This is a result of the "Block cookies and other website data" privacy setting being set to "From third parties and advertisers". Any cross-storage client code will not crash, however, it will only have access to a sandboxed, isolated local storage instance. As such, none of the data previously set by other origins will be accessible. If an option, one could fall back to using root cookies for those user agents, or requesting the data from a server-side store.
The Host
will determine the whitelisted domains that can access the Host
new CoherentDataIntegration.Host([
{
origin: /\.host.com$/,
allow: ["get", "set"],
{
origin: /\.client.com$/,
allow: ["get"],
},
]);
The Client
will determine the Host domain and the mode that it will be used is handover
const client = new CoherentDataIntegration.Client('handover', 'http://www.host.com');
// Client triggers sending the payload to Host
client.send({
name: 'John Doe',
age: '35',
gender: 'Male',
})
// Client listens to received payload and automatically deletes the storage
client.receive()
.then((result) => {
return result; // Result: { name: 'John Doe', age: '35', gender: 'Male' }
})
});
Parent: https://data-integration-lib.s3.ap-southeast-1.amazonaws.com/host.html Client: https://data-integration-lib.s3.ap-southeast-1.amazonaws.com/client.html
The Parent
can send and receive data to Child
.
<!-- host.html -->
<iframe src="https://www.client.com" id="coherent-frame"></iframe>
// @param
// mode: embedded | handover
// iFrameID: string
const client = new CoherentDataIntegration.Client('embedded', 'coherent-frame');
client.onReceive(data => console.log(data)); // Result: {name: 'Jane', age: 34}
client.send({ name: 'John', age: 28 });
The Client
can send and receive data to the Parent
// @param
// mode: embedded | handover
const client = new CoherentDataIntegration.Client('embedded');
client.send({ name: 'Jane', age: 34 });
client.onReceive(data => console.log(data)); // Result: {name: 'John', age: 28}
Results are using Node v16.11.1 on Macbook Pro M1 8GB Ram
Object Size | encode | decode |
---|---|---|
1MB | JSON x 436 ops/sec ±1.69% (94 runs sampled) | JSON x 390 ops/sec ±0.47% (92 runs sampled) |
2MB | JSON x 205 ops/sec ±2.25% (82 runs sampled) | JSON x 172 ops/sec ±2.66% (81 runs sampled) |
3MB | JSON x 144 ops/sec ±1.27% (83 runs sampled) | JSON x 126 ops/sec ±0.62% (82 runs sampled) |
1000 keys | JSON x 13,722 ops/sec ±3.74% (86 runs sampled) | JSON x 7,077 ops/sec ±4.22% (87 runs sampled) |
10000 keys | JSON x 819 ops/sec ±0.85% (94 runs sampled) | JSON x 556 ops/sec ±4.54% (87 runs sampled) |
FAQs
- Cross-domain browser storage API and secure bi-directional `postMessage` iFrame communication. - Data object size is limited up to 3MB.
The npm package @coherentglobal/data-integration-lib receives a total of 19 weekly downloads. As such, @coherentglobal/data-integration-lib popularity was classified as not popular.
We found that @coherentglobal/data-integration-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.