onAuthUnsuccessful accepts custom server messages, either a string in response.body or a JSON {clientData: 'customMessage' }
- update deps
New API to create double ended queues, a new implementation of lists that are efficient in network usage.
- Polyfill buffer since webpack doesn't do it starting v5
- remove outdated deps
- Enable localstorage in client options. This provokes a breaking change for current users of offline record functionality. if you're not using offline records, there are no breaking changes.
- Logic around dirty records and state transitions
- update deps
- code comments
- update deps
- code comments
- data types when using record.set with path
- Updating dependencies
- RPC provider callback now can return the rpcRequestorName and rpcRequestorData as third parameter if the server configuration mandates they are sent to the provider.
- Add missing return statements
- Remove yarn.lock
- Handle write ack errors now sent by deepstream server >= v6.1.0. This comes with some changes to state machine logic.
- Various error logs
- Updating dependencies
- Add missing read registry
- Updating dependencies
- Updating dependencies
- ignore version conflicts that are of equal resolved values and state is not merging
- ignore version conflicts that are of equal resolved values and state is not merging
Implement CI using github actions.
Remove rpcAcceptTimeout and rpcResponseTimeout from client logic. These timeouts will be handled server side only.
- send heartbeats strictly according to
heartbeatInterval
.
- Send heartbeat packets according to
lastSentMessageTimestamp
, notlastRecievedMessageTimestamp
.
- Updating dependencies
- React-native postinstall script for Windows
- Typescript definitions for record subscribe method
- React-native post install script must point to non-minified bundle.
- Remove callback after calling single notifier with error. This was preventing future messages from being sent after reconnection.
- Undo last changes to
discard()
andunsubscribe()
logic. Those operations only affect the current record instances, not all instances of the record in the client. - provide context for record subscriptions
- Fix emitter logic
- Discard all references of a record when calling
.discard()
- Remove subscriptions from record reference when calling
.unsubscribe()
- Bump dependencies
- set main file in package.json to
dist/src/deepstream.js
- add postinstall script that works when passing the
DEEPSTREAM_ENV=react-native
variable to the npm install command in order to change the main file in package.json todist/bundle/ds.min.js
for react-native usage.
- set main file in package.json to minified bundle
- Revert the explicit Buffer import since it's not required when using the bundled client file.
- Manipulate string url in socket factory without external dependencies. Fixes #515
- Export the client constructor as object in order to maintain api in bundle.Fixes #528
- Make explicit Buffer import. Fixes #529
Send down sdkVersion and sdkType to server on challenge for better metrics
Fixes #504: WriteAcks on conflicts
This needs to be used with server 5.0.17 in order to work.
The issue was VERSION_EXISTS didn't go through the ack service which resulted in it never reacting.
To test this, run ts-node bugs/504-merge-conflict-silent.ts
in
two terminals
Fix connection timeouts if server doesn't send something in time
When a user has permission to read but not write to record, when trying to set with ack the error callback was not triggered and the client hanged indefinitely.
Deep-compare method in record change event emitter, this prevents spurious events when users are subscribed to a record path pointing to an object.
Updating dependencies
Revert: Allow to work on react native (at cost of bigger bundle size)
Updating dependencies
Allow to work on react native (at cost of bigger bundle size)
Method signature for the DeepstreamClient.login()
overload that takes only a callback was incorrect
Linting issue failed release build
Actual library fix, previous one was a spoof
Adding library directly into browser from webpack should expose DeepstreamClient globally
Added a missing transition state on record resubscription
Importing and creating the client has changed in order to be less insane when using typescript.
When creating the client you now do:
const { DeepstreamClient } = require('@deepstream/client')
const dsClient = new DeepstreamClient(url, options)
instead of:
const deepstream = require('@deepstream/client')
const dsClient = deepstream(url, options)
Another socketOptions defaulting issue
Defaulting socketOptions in socket wrapper factory.
Adding a jsonTransportMode
flag that can be passed to socketOptions
that allows the client
to talk to the server in JSON. This is mainly done to help people to debug writing new SDKs and
should not be used in production.
Including a default implementation of timeouts using the native setTimeout API. The interval based one was created in order to mitigate the insane amount of ack registries we used to have get created, and also because setting timeouts isn't cheap (you can verify this by creating a couple thousand records and noticing the cost within the default noop storage registry). However as correctly stated by @Krishna here the interval implementation is naive in terms of mobile (looping every 20milliseconds for idle connections is overkill) and the benefits now is no longer as apparent as during the RC release (since bulk messaging now only makes one timeout for N amount amount of subscriptions).
You can toggle them with the following:
# When true uses setTimeout
nativeTimerRegistry: true,
# When nativeTimerRegistry is false uses an interval with this timer resolution
intervalTimerResolution: 50,
Either ways both implementations are expensive in terms of garbage collection since it binds to the context and data as part of the API. This can probably be avoided by providing a null context going forward.
Lists were not propagating the events on record-core. Discard, delete and error is now properly passed, and documentation needs to be updated to indicate the ready event was dropped in V4
The initial version change seems to have broken some things, so it is now configurable and defaults to 1
If record is in readonly mode, only subscribe and read, don't try to upsert / create
Adding notify on record handler to notify if the db was changed without using deepstream APIs
Change error message on connection to pass through error
This shouldn't be a breaking change for those with offline disabled, which noone is using yet hence the patch release. This just changes the initial version 1 to 0
- Adding a readOnlyFlag
This is an issue where when not doing offline first requesting a record that doesn't exist would result in a new empty record being created (locally) with no data. This would break bindings for some people. Instead what we do now is use a recordReadOnlyMode flag which indicates that we expected most records to be only ever read from server, and hence will only be ready on data load. You can explicitly mention the things you do want to write to via a recordPrefixWriteWhitelist.
- Also added a transition from unsubscribing to deleted, because so many transitions.
- Do a deep compare when setting data to avoid processing unchanged values
- 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
}
- 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
- 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))
})
You can see the in depth side explanation of the changes here
- 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
- error messages are now stringified to better display information #386 courtesy of @SejH
- improved handling of parameters in calls to
client.record.setData
- moved e2e steps into deepstream.io repository
- Update
dist/
files correctly
- Clients are now able to perform and upsert operation
CU
(create and update) viaRecordHandler.setData
. This allows writing to records while not subscribed to them locally
- Heartbeat timeout now emits the reconnect event
- 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.
- Tightened up typescript callback interfaces by @EnigmaCurry
- Using main file as
dist/deepstream.js
oversrc/client.js
- 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
- 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
- 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
- Fixed the generated dist release files
- 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
- Additional tests around presence and records #284 and #285
- Allow passing of node socket options into constructor #289
- Fix bug in JSON path when updating nested null values #281
- Adding check for undefined entries in single notifier #291
- Added support for the deepstream
presence
API, enabling querying and subscribing to who is online within a cluster. For example:ds.presence.getAll((users) => { users.forEach((username) => { console.log(`${username} is online`) }) }) ds.presence.subscribe((username, loggedIn) => { if (loggedIn) { console.log(`${username} has logged in`) } else { console.log(`${username} has logged out`) } })
- Added heartbeats over WebSocket connection
- Presence has been added to query and subscribe to who is online with the cluster
- E2E tests refactored
- Supports deepstream.io v2.0.0+ only
- Changed format of RPC request ACK messages to be more consistent with the rest of the specs #408
- We now depend only on browser/node.js WebSockets, removing support for TCP and engine.io
- Support for webRTC has been removed
- Connection errors now occur on the CONNECTION topic
- Message denied clears down associated ACK timeout messages
- Optimize and refactor records by @ronag
- Porting over remaining e2e tests
- Adding specs as part of the client project and build
add a third argument for the listen callback (client.record.listen
and client.event.listen
) which contains
an object which two functions (accept
and reject
). One of these functions needs to be called otherwise you
will get a deprecated message. #203 #212
This enhancements fixes some issues like #74 #155 #170
Records supports now a boolean flag (record.hasProvider
) which indicates whether a listener has accepted providing data. You can also subscribe to event which is triggered when the flag changes:
record.on('hasProviderChanged', hasProvider => {
/* do something */
})
API checks are now in place that throw an error if you provide the incorrect argument amount or types #207 by @ronag
Gherkin tests are now used for E2E testing, allowing e2e tests to be run against any language rather than just node, and allows writing more scenarios much easier
- allow do create and discard the same record in a synchronous loop #167
- record snapshots are not waiting for
isReady
#140 - record subscriptions are not waiting for
isReady
in combination withtriggerNow
#138 - broken unsubscribe due to wrong internal argument delegation #190
- Terminate unauthenticated connections after a timeout #226
- Fixed issue where deleted record was not getting removed
Users can now set a global and per record merge strategy. This allows the application to respond to VERSION_EXISTS
and use a REMOTE_WINS
, LOCAL_WINS
or a custom merge strategy
Global:
const client = deepstream( 'localhost:6020', {
mergeStrategy: deepstream.MERGE_STRATEGIES.REMOTE_WINS
});
Local:
const record = client.record.getRecord( 'user/1' )
record.setMergeStrategy( ( record, remoteValue, remoteVersion, callback ) => {
callback( null, remoteValue )
} )
deepstream protocol now has a connection establishment handshake that allows the client to be redirected to another deepstream before requesting/publishing data
Users can now delete content within records by setting it to undefined
record.set( path, undefined )
Client size bundle has been reduced by not including mocks for the tcp connection
Record discards and deletes now get called after when ready, which makes the API cleaner
Before:
record = client.record.getRecord( 'user1' )
record.set( 'name', 'bob' )
record.onReady( () => {
record.discard()
})
Now:
record = client.record.getRecord( 'user1' )
record
.set( 'name', 'bob' )
.discard()
You can now access constants on deepstream
// on the constructor
const C = deepstream.CONSTANTS;
// and instance
const client = deepstream( 'localhost:6020' )
CONST C = client.CONSTANTS;
The login callback now only takes two arguments instead of three. This is to make it easier for the user to send their own custom data from an authentication hander or when using the http authentication handler
client.login( {}, ( success, data ) => {
if( success ) {
// data is meta data associated with user session
// or null
} else {
// data is error message or custom error object
// with reason why or null
}
} )
We now use deepstream
instead of engine.io
as the default engineio path
-
Login after logout doesn't overide auth parameters #88
-
Deepstream not updating object properties #96 ( @drsirmrpresidentfathercharles )