Websockets and Bonita


It's possible to use websockects to send information about the state of the workflow to make an interface react?

A process that catches events of 5 participants voting and I wanted to send, when all voted, a typified message through a websocket that is listening on the other application (back-end or front-end).

The interface and application referred above aren't the default Bonita portal.

Anyone has already tried this?
Is there any alternative on the API that you know of?


3 answers


What generates this error, is that the vendors are getting the incomplete way. To eliminate this problem I edited the file to handle with this. Then edit the vendors-1472572145629.min.js file (you can rename it, just see the name of the browser by the browser name), which is in the folder C: \ {{pretty}} \ workspace \ tomcat \ webapps \ designer \ WEB -INF \ classes \ static \ js

Search for === "http" and change the method that addresses this question

var z = y.websocket = function(a, d) {
var e = this,
f = d + "/websocket";
if(f.slice(0, 4) === "http")
f.slice(0, 5) === "https" ? f = "wss" + f.slice(5) : f = "ws" + f.slice(4), e.ri = a, e.url = f;
f = 'ws://' + window.location.host + window.location.pathname.substring(0, window.location.pathname.indexOf('/', 1) + 1) + f, e.ri = a, e.url = f;

    var g = b.WebSocket || b.MozWebSocket;
    e.ws = new g(e.url), e.ws.onmessage = function(a) {
    }, e.unload_ref = c.unload_add(function() {
    }), e.ws.onclose = function() {
        e.ri._didMessage(c.closeFrame(1006, "WebSocket connection broken"))


I suggest you implement this function in your application or in a mid-application between Bonita and your application.

I guess there's a few sub processes in your main process to cater for several participants, and in your main process there should be a BDM to represent final vote status. So you have two options here to get the vote status.

Option 1:
Implement an REST or Web Service interface in your application, which Bonita can use to push vote status to your application.

Option 2:
Implement a timer in your application, and pull vote status on regular basis. You can use Bonita REST API to pull data.

You can choose either one based on your circumstance, and then send notification to your application frontend via WebSocket, please refer to Sean McP's answer how to do it.

WebSocket requires one additional port to be opened, you may consider in your solution.

If you cannot have one more port, there's two alternative options: Server-Event and long-pulling.


You should be able to do this with the correct libraries installed:

here is an example of how to do it from java. You should be able to work this into a script connector.



PS: If this reply answers your question, please mark a resolved.