3.1.0 issue & question

Hello,

You just released v3.1.0.

Firstly, the minified file in the npm package seems to have a new dependency of the ‘dns’ npm package?

This dependency was not found:                                                                                                                            
* dns in ./node_modules/sendbird/SendBird.min.js                                                                                                          
To install it, you can run: npm install --save dns

Why is this and why isn’t it documented? ‘dns’ is not listed as a dependency in package.json.

Secondly, you introduced a new localCacheEnabled parameter to the SendBird constructor. Looking briefly through the code, this seem like a breaking change, or at least something to be aware about. Yet I don’t see any documentation anywhere? The parameter isn’t mentioned anywhere in the docs either.

Also, does this new cache functionality been tested for compatibility with SyncManager? I can imagine some conflicts if both the SendBird SDK and the SyncMaster SDK are fighting each other about being the best one to cache :slight_smile:

1 Like

Hi @mmilo,

dns is a built in node API. There is no need for it be listed in the package.json.
https://nodejs.org/api/dns.html#dnslookuphostname-options-callback

I updated to 3.1.0 in my own personal project and have no run into any errors. What version of node do you have installed?

In regards to localCache, this is a new feature that is just been released in 3.1.0. It will be replacing SyncManager and SyncManager will be deprecated. More documentation and announcement information to come.

Documentation has been released for JavaScript here: Local caching | Chat JavaScript SDK | Sendbird Docs

Hi @Tyler,

Unfortunately the dependency on the dns Node API breaks the ability to use sendbird on ReactNative. (The API does not exist).

Was this an intentional break? How can we continue to use sendbird + ReactNative?

Thanks!

Hey @Reagan,

Let me connect with our Engineering team to discuss.

Hi all,

We’ve released V3.1.1 that should resolve this dns issue. Please give it a try and report back if you run into any issues with it.

Sounds good, can confirm dns dependency isn’t an issue anymore.

You should look through the new local caching docs though, already found an issue that one probably wouldn’t know how to fix, if not looking at the typescript interface.

var groupChannelCollection = sb.GroupChannel.createChannelCollection()

Should be sb.GroupChannel.createGroupChannelCollection() and since it isn’t being redeclared you should set it as a const instead :slight_smile:

1 Like

Thank you @mmilo We will update this ASAP!

1 Like

Local caching isn’t working at all for us – we are using v3.1.1 and running the JS SDK in our react-native app. sendbird.connect just returns “Store is not available. Check your environment settings.”. Using SyncManager, we had to set the store to AsyncStorage. There must be a similar API for local caching, no?

1 Like

Also running into the same issue. On iOS sendbird.connect just returns “Store is not available. Check your environment settings.”

@Liam_Cho is the intention to support react-native local caching? And if so, is there a timeline you could share with us? We’d like to know before we migrate our chat system from syncmanager (which has been unreliable) to local caching. Thank you!

2 Likes

So I see that v3.1.4 included a useAsyncStorageAsDatabase method (with zero documentation) and this has solved the “Store not available…” issue for us. But local caching is totally unreliable in our react-native app. It actually doesn’t really work at all and we feel confident we have set up the group channel and message collections appropriately.

For example, sending a message while offline returns a failed message in the onMessageAdd callback, but that failed message is not returned from the cache once the message collection is re-initialized. Another issue is pending file messages are not immediately returned in onMessageAdd – only the final, delivered message hits this handler.

The biggest issue of all is neither of the collections re-hydrate the view handlers when sb.connect fails. In the documentation for local cache sendbird initialization, it claims “local caching and SyncManager ensure that your client app is operational during offline mode”. But when sb.connect fails, nothing is returned from cache (onChannelAdd is not called for example). So it just doesn’t seem to work in offline mode unless we are missing something crucial. What’s strange is in the same documentation, it also claims:

Note: If initialization fails to complete while the localCacheEnabled is set to true, the Chat SDK will operate as if the localCacheEnabled is set to false.

So… if sb.connect fails and the SDK operates without cache, how are we supposed to use this offline?

We’re excited about this feature but disappointed in the react-native support so far. An example app in the sendbird js sdk examples repo would be much appreciated.

Hi @drewandre thanks for highlighting these issues. I’m also trying to migrate to localCaching but running into issue with React Native.

I found the issue you mentioned about pending file messages not returned in the onMessageAdd method and told the support team about it. They were apparently going to fix this issue “early this week” but it’s already Thursday today.

I’d suggest sending an email to their support team with these issues. They seem to be more responsive there compared to the community here.