Transfering the Commandstack


#1

Hello Everyone,

first of all thank you very much for the great help you have given me during my last projekt!

Now i was tasked with a new project in regard to this modeler. Simply put i need to enable 2+ people to work on the same model at the same time.

After a short research on how to possibly realize this, i came up with the following Idea:

  1. Use the Command Interceptor to catch all Commands from a User (Command Interceptor)
  2. Transfer the Commands to my expressjs Backend. Where I have Publisher/Subscriber Pattern for everyone currently using the model
  3. Transfer the Command from the Backend to every subscribed User and execute it on the CommandStack there(CommandStack

This way all users should have the same model after anyone has made a change.

Would be great if someone who has expierience with the Command Stack could confirm if my approach is doable.


#2

:+1:

This approach is doable.


#3

Hi nikku, thx for the help again.

Maybe you can help me with this too?

After a few weeks, i am now able to use your modeler with command interceptor in my angular2 Projekt and have established a pub/sub pattern to tranfer the commandstack. However i still have some trouble.

First some of my Code:
CommandInterceptor

commandInterceptor.prototype.execute.call(commandInterceptor, ( event : any ) =>  {
            if (typeof event.context.remote === 'undefined') {
                event.context.remote = 'yes';
                console.log('command execute logger', event);
                this.client.publish('IPIM', JSON.stringify(event));
          }
        });

receiver on the second PC:

this.client.on('message', function(topic: any, message: any) {
            console.log('command from remote:' + message.toString());

            const event = JSON.parse(message);
            console.log( event);
            commandStack.execute(event.command, event.context);
          });

If i create for example a task on the first pc it works without a problem. All the commands are logged and as far as i can see transfered to the second pc. But on the second pc i only get a pink square as placeholder and when i click on the element i get “TypeError: bo.get is not a function” in my console.

If i create the same task on the first PC, delete it and recreate it by using commands 1 to x from the commandstack it works without a problem.

So it looks like i am missing something to transfer as the commands on the second pc don’t create a business object?

Would be nice if someone could help me … stuck for some hours without a clue what i am missing.