orbit-db-cache-postmsg-proxy

    0.1.1 • Public • Published

    orbit-db-cache-postmsg-proxy

    PostMessage Proxy Cache for orbit-db, wraps orbit-db-cache.

    Use Case

    If configured with ipfs-postmsg-proxy, allows for all orbitdb state to be stored in iframe. Allowing the same store to be shared across domains. Minimizing syncs and times to load DBs. Reference 3box-js for an example which implements this.

    Used in

    Usage

    Server/Client model that has an RPC interface bewteen the two. The "server" will run the cache and the store state. It waits for requests from the "client". The "client" implements the same API as orbit-db-cache, but all function calls are sent and executed by the "server". Use in "client" window the same way you would use orbit-db-cache.

    Server

    In the "server" window (likely an iframe):

    import { Server } from 'orbit-db-cache-postmsg-proxy'
     
    Server()

    Client

    In the "client" window (likely parent window):

    import { Client } from 'orbit-db-cache-postmsg-proxy'
    import OrbitDB from 'orbit-db'
    ...
     
    const cache = Client()
    new OrbitDB(ipfs, orbitPath, {cache})

    Client API

    Reference orbit-db-cache

    Keywords

    none

    Install

    npm i orbit-db-cache-postmsg-proxy

    DownloadsWeekly Downloads

    820

    Version

    0.1.1

    License

    none

    Unpacked Size

    4.38 kB

    Total Files

    5

    Last publish

    Collaborators

    • zachferland