Skip to content

Two way sync not working as expected. #22

@thedangler

Description

@thedangler

I'm having an issue syncing data.
Can someone tell me if I'm doing it wrong.
I posted this in stackoverflow and got no responses.

whats happening is in window one.
If I update my teams array then do a bucket.update('team-1',teams);
in console 2 i see the new updated teams object and its put into Simperium properly.
However in window 2
when I do the exact same thing after receiving the new teams object
window 1 doesn't get the update nor does simperium.

code is bellow.

var bucket = simperium.bucket('teams');

            var teams = {"key":"data","other":[1,2,3,4,8]};

            bucket.on('notify', function(id, data) {
                console.log("object "+id+" was updated!");
                console.log("new data is:");
                teams = data;
                console.log(data);
            });
            bucket.on('local', function(id) {
                console.log("request for local state for object "+id+" received");
                console.log(teams);
                return teams;
            });
            bucket.on('error',function(e){
               console.log('error',e); 

            });

            bucket.on('notify_init', function(id, data) {
                console.log("got existing data for id: "+id);
                console.log("data =");
                console.log(data);
                bucket.update('team-1',teams);
            });
            //bucket.update('team1',JSON.stringify(teams));
            bucket.on('ready', function() {
                console.log("Finished sending notifications for existing objects!");
                bucket.update('team-1',teams);
            });
            bucket.start();

Thank you.
I really want to use this over firebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions