const start_socket = false; if (start_socket){ socket_start(); }
var websocketElement = document.getElementById('websocket'); //find any elements with id websocket if (websocketElement){ socket_start(); }
You can use it as your wish. OR using basic example bellow :
<pre>
if (conditional) {
socket_start();
}
$websocket = new WMI_websocket(false, false); /* Data Example */ $websocket->createData([ 'pendapatan_max_invoice' => 45, 'piutang_max_invoice' => 55, 'hutang_max_invoice' => 65, 'pengeluaran_max_invoice' => 67, ]); $websocket->SEND();
$websocket = new WMI_websocket(false, false); $websocket->createData([ 'pendapatan_max_invoice' => 45, 'piutang_max_invoice' => 55, 'hutang_max_invoice' => 65, 'pengeluaran_max_invoice' => 67, ])->SEND();
WMI_websocket::i(false, false)->createData([ 'pendapatan_max_invoice' => 45, 'piutang_max_invoice' => 55, 'hutang_max_invoice' => 65, 'pengeluaran_max_invoice' => 67, ])->SEND();