Skip to content

Releases: deepstreamIO/deepstream.io-client-js

Typescript, Offline Support and so much more!

30 Jul 16:30
Compare
Choose a tag to compare

Features:

  • New binary protocol support (under the hood)
  • Bulk actions support (under the hood)
  • Full typescript declaration files
  • Promises everywhere! Long live async/await!
  • Offline record support
{
    // Use indexdb to store data client side
    offlineEnabled: false,
    // Save each update as it comes in from the server
    saveUpdatesOffline: false,
    indexdb: {
        // The db version, incrementing this triggers a db upgrade
        dbVersion: 1,
        // This auto updates the indexdb version if the objectStore names change
        autoVersion: false,
        // The key to index records by
        primaryKey: 'id',
        // The indexdb databae name
        storageDatabaseName: 'deepstream',
        // The default store name if not using a '/' to indicate the object store (example person/uuid)
        defaultObjectStoreName: 'records',
        // The object store names, required in advance due to how indexdb works
        objectStoreNames: [],
        // Things to not save, such search results
        ignorePrefixes: [],
        // The amount of time to buffer together actions before making a request
        flushTimeout: 50
    }
}
  • Customizable offline storage support
export type offlineStoreWriteResponse = ((error: string | null, recordName: string) => void)

export interface RecordOfflineStore {
  get: (recordName: string, callback: ((recordName: string, version: number, data: RecordData) => void)) => void
  set: (recordName: string, version: number, data: RecordData, callback: offlineStoreWriteResponse) => void
  delete: (recordName: string, callback: offlineStoreWriteResponse) => void
}

Improvements

  • Separation of errors and warnings for clarity. Non critical failures (such as an ack timeout) can now be treated separated or fully muted.
  • Enhanced services to reduce timeout overhead

Backwards compatibility

  • Only works with V4 server
  • All single response APIs now return promises when not providing a callback. This means most APIs that could have been chained would now break.
const client = deepstream()
try {
    await client.login()

    const record = client.record.getRecord(name)
    await record.whenReady()

    const data = await client.record.snapshot(name)
    const version = await client.record.head(name)
    const exists = await client.record.has(name)
    const result = await client.rpc.make(name, data)
    const users = await client.presence.getAll()
} catch (e) {
    console.log('Error occurred', e)
}
  • Listening

The listening API has been ever so slightly tweaked in order to simplify removing an active subscription.

Before when an active provider was started you would usually need to store it in a higher scope, for example:

const listeners = new Map()

client.record.listen('users/.*', (name, isSubscribed, ({ accept, reject }) => {
    if (isSubscribed) {
        const updateInterval = setInterval(updateRecord.bind(this, name), 1000)
        listeners.set(name, updateInterval)
        accept()
    } else {
        clearTimeout(listeners.get(name))
        listeners.delete(name)
    }
})

Where now we instead do:

const listeners = new Map()

client.record.listen('users/.*', (name, ({ accept, reject, onStop }) => {
    const updateInterval = setInterval(updateRecord.bind(this, name), 1000)
    accept()

    onStop(() => clearTimeout(updateInterval))
})

TLDR;

You can see the in depth side explanation of the changes here

v2.3.0

25 Sep 13:47
Compare
Choose a tag to compare

[2.3.0] - 2017-09-25

Features

  • the presence feature can now be used on a per user basis. The online status of individual users can be queried for as well as subscribed to. Check out the tutorial on our website here

Improvements

  • error messages are now stringified to better display information #386 courtesy of @SejH
  • improved handling of parameters in calls to client.record.setData

Miscellaneous

[2.2.1] - 2017-06-02

02 Jun 07:45
Compare
Choose a tag to compare

Fixes

  • Update dist/ files correctly

[2.2.0] - 2017-05-30

30 May 07:44
Compare
Choose a tag to compare

Features

  • Clients are now able to perform and upsert operation CU (create and update) via RecordHandler.setData. This allows writing to records while not subscribed to them locally

Fixes

  • Heartbeat timeout now emits the reconnect event

v2.1.5

03 May 15:16
Compare
Choose a tag to compare

[2.1.5] - 2017-05-03

Bug Fixes

  • Calling login() with a callback (but no auth data) now behaves as you would expect.
  • Fix issue where client did not emit MAX_RECONNECTION_ATTEMPTS_REACHED event by @rbarroetavena.

Small Enhancements

11 Apr 17:02
Compare
Choose a tag to compare

[2.1.4] - 2017-04-11

Enhancements

  • Tightened up typescript callback interfaces by @EnigmaCurry

Small Fixes

  • Using main file as dist/deepstream.js over src/client.js

Bug fixes and small enhancements

08 Apr 16:31
Compare
Choose a tag to compare

[2.1.3] - 2017-04-08

Enhancements

  • Write acks now called with a failure message if connection is down by [@erik Karlsson](@erik Karlsson)
  • Write acks now called with null if value hasn't changed by [@erik Karlsson](@erik Karlsson)
  • Linting / Babel support
  • Improved a few typescript bindings by @EnigmaCurry
  • Changed heartbeat missed message to include time
  • Setting anonymous record with same name no longer discards and resubscribes the record

Bug Fixes

  • Invalid remote wins merge conflicts
  • Prevent records from being set with scalar values by @datasage
  • Prevent bad login message from constantly attempting to reconnect by @datasage
  • RecordHandler invalid destroy state emitted an error instead of using client._$onError

Small enhancements

04 Mar 22:01
Compare
Choose a tag to compare

[2.1.2] - 2017-02-28

Enhancements

  • heartbeat missed should close connection #324
  • optimized json-path patch #329
  • TypeScript typings #283 and #338
  • Added support for non-NaNish base 16 numbers in jsonpath #328
  • There is now a single ack timeout registry for the client, shared between all handlers. This means that ack timeouts are cleared when the connection is lost and don't occur when the connection is not open #342

Bug Fixes

  • reset queued methods in List once called #315
  • fix queued methods by passing index to .bind() #316

Fixed release distribution files for browsers

21 Dec 09:41
Compare
Choose a tag to compare

[2.1.1] - 2016-12-21

Bug Fixes

  • Fixed the generated dist release files

Record write acknowledgements

20 Dec 15:26
Compare
Choose a tag to compare

[2.1.0] - 2016-12-21

Features

  • Record write acknowledgement. Records are now able to be set with an optional callback which will be called with any errors from storing the record in cache/storage #290

Enhancements

  • Additional tests around presence and records #284 and #285
  • Allow passing of node socket options into constructor #289

Bug Fixes

  • Fix bug in JSON path when updating nested null values #281
  • Adding check for undefined entries in single notifier #291