Is it possible to use bpmn from multiple devices using sockets?

Hello everyone, is it possible to use bpmn from multiple devices using sockets?

Hi Harut,

Could you provide more details about what you’re trying to achieve?

Hi azeghers,
Thanks for contacting me.
I was wondering if it’s going to be posible to send all the content of diagram.bpmn file to the other people through socket.io and change the file content dynamically with the one I am sending them ?

I would need more context about your project, please share a CodeSandbox that reproduces your setup.

Generic answer: anything is possible with enough JavaScript.

Going by the example here:

<script>
  var viewer = new BpmnJS({ container: 'body' });

  viewer.importXML(bpmnXML, function(err) {

    if (err) {
      console.log('error rendering', err);
    } else {
      console.log('we are good!');
    }
  });
</script>

You would send the bpmnXML over a websocket, and in the socket handler call viewer.importXML.

In terms of two-way sync (editing at both sides), you are going to have to manage diffing, otherwise it will be like CB radio, where one person can edit at a time, and if two people try to edit then only one set of changes become canonical.

You might be able to use TogetherJS to help build that part.

Josh

1 Like

Guys I post and get xml file, I want the xml file that i get to insert in my diagram.bpmn file, is it possible? thanks in advance.

Yes, it is possible.

Azeghers is onto it. If you need more specific help, you will need to bring more specific context, like a Code Sandbox, or at least a complete description of the system in pseudocode.

Еhank you already received.

image

image

As Jwulf stated, you can fetch your updated diagram through the websocket and reimport it using bpmn-js.

If you still need help you would have to get specific with what doesn’t work for you, and share a working version of your project through CodeSandbox.

Thanks, everything is working well!

1 Like