Gyroscope / WebSocket Synchronization
Starting v5.0, stale records (conflicting record changes) are indicated by push notifications. This feature requires browsers that support HTML5 WebSockets.
In addition, the browser must handle secured web socket (wss://) correctly for HTTPS deployments.
WebSocket Server Configuration
WSS is not enabled by default; it can be activated by editing the settings in
ws_js.php:
wss_init(); //uncomment this line
...
$wsuri='ws://yourdomain:8001/wss.php';
If the application runs on HTTPS, use the wss:// protocol and tunnel the port:
$wsuri='wss://yourdomain:8000/wss.php';
[https]
accept = 8000
connect = 8001
Be sure to modify the settings in the server script to reflect the above configuration. When a connection is successfully established, a connection ID is displayed in the browser's developer console:
web socket connected
registered sid 31
Implementing Push Warning
Gyroscope detects record changes by feeding off the
security journal.
Additional parameters,
rectype and
recid are supplied to the
logaction function:
logaction("updated product $productname",
array('productid'=>$productid,'product'=>$productname),
array('rectype'=>'product','recid'=>$productid) );
Tab level records change their titles to red when changed in another browser window:
Specific regions, also known as the "critial sections" can be registered in
wss.js:
switch(rectype){
case 'filmactors':
if (gid('filmactors_'+recid)) gid('filmactors_'+recid).style.backgroundColor=bgcolor;
break;
}
In the above example, the critical section responds to the
filmactors record type. If the event originates from an external browser, the
marked region is painted yellow; otherwise it's restored to white.