I'm using AngularJS and have created a SocketService which is essentially just a wrapper for portal. Currently I'm passing a UUID with each request. This isn't a fantastic solution and I'd like to come up with a better way to do it.
service.makeInactive = function (doneCallback) {
return SocketService.send('makeInactive', { workstationUuid: $rootScope.workstation.uuid }, function (r) {
$rootScope.workstation.active = !r;
if (doneCallback != null)
doneCallback(r);
$rootScope.$apply();
});
}
/* Make a workstation active - will begin accepting new work */
service.makeActive = function (doneCallback) {
return SocketService.send('makeActive', { workstationUuid: $rootScope.workstation.uuid }, function (r) {
$rootScope.workstation.active = r;
if (doneCallback != null)
doneCallback(r);
$rootScope.$apply();
});
}
/* Set work as being completed so it can progress to the next workflow process */
service.completeWork = function (work, doneCallback) {
if (!work.isArray)
work = new Array(work);
return SocketService.send('completeWork', { workstationUuid: $rootScope.workstation.uuid, work: work }, doneCallback);
}