AceBase Client is a JavaScript/TypeScript library designed to connect to and interact with a remote AceBase realtime database server. It provides functionalities for reading, writing, querying, and subscribing to real-time data changes within an AceBase database. The current stable version is 1.22.3, with an active release cadence that frequently addresses bug fixes and introduces minor features, often preceded by release candidates. This client acts as the bridge for applications to leverage AceBase's NoSQL, schemaless, object-tree data model, supporting complex queries and robust authentication mechanisms. Its primary differentiator is its tight integration with the AceBase server ecosystem, enabling efficient data synchronization and real-time event handling for connected applications, both in Node.js and browser environments.
npm install acebase-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates connecting to an AceBase server, logging an event, performing a read/write operation, and setting up a real-time subscription for data changes. Includes environment variable usage for configuration.
Review usage of `db.ref().sync()` and adapt code to the new return format. Consult the AceBase documentation for specific details on the updated structure.
Update error handling code to specifically check for `isServerError` in addition to `isNetworkError` where applicable, or use `instanceof AceBaseRequestError` for broader catching.
Upgrade to v1.8.0 or newer to use `db.auth.setAccessToken(accessToken)` for seamless sign-in on reconnection. For older versions, implement custom logic to re-authenticate manually upon `connect` event.
For browser-only applications without bundlers, use `<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/acebase-client@latest/dist/browser.min.js"></script>`. For modern web development, use a module bundler like Webpack or Rollup to utilize `import` statements.
For browsers, ensure `<script src="...">` is loaded. For Node.js, verify `import { AceBaseClient } from 'acebase-client';` for ESM or `const { AceBaseClient } = require('acebase-client');` for CommonJS is used correctly based on your project's module type.Verify that the AceBase server is running, listening on the specified host and port, and that no firewall is blocking the connection. Double-check `host`, `port`, and `https` options in the `AceBaseClient` constructor.
Ensure correct credentials are provided to `db.auth.signIn`, `signInWithEmail`, or `signInWithToken`. If using tokens, ensure they are still valid. Check server-side authentication rules.