Simple Websocket Writen in PHP and Javascript

Websocket How to
Javascript Download
JS Usage Example
By Variable OR Const
const start_socket = false;
if (start_socket){
  socket_start();
}
      
By Element Exists
var websocketElement = document.getElementById('websocket'); //find any elements with id websocket
if (websocketElement){
  socket_start();
}
      
Others

You can use it as your wish. OR using basic example bellow :

      <pre>

if (conditional) {
socket_start();
}




PHP Download
PHP Usage Example
PHP Normal Usage
$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();
        
PHP Object Oriented Usage
$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();
        
PHP Static Object Oriented Usage
WMI_websocket::i(false, false)->createData([
  'pendapatan_max_invoice' => 45,
  'piutang_max_invoice' => 55,
  'hutang_max_invoice' => 65,
  'pengeluaran_max_invoice' => 67,
])->SEND();