#!/usr/bin/php
<?php
# Count from 1 to 10 with a sleep
for ($count = 1; $count <= 10; $count++) {
echo $count . "\n";
usleep(500000);
}
?>$ websocketd --port=8080 my-programvar ws = new WebSocket('ws://localhost:8080/');
ws.onmessage = function(event) {
console.log('Count is: ' + event.data);
};
if (!file_exists( $fifoPath )) posix_mkfifo( $fifoPath, 0600 );$fifoPath = __DIR__ . '/1.fifo';
if (!file_exists($fifoPath)) {
print "User not active \n\n";
exit(0);
}
$fifo = fopen( $fifoPath, 'w' );
$data = "Richard Miles \n";
fwrite($fifo, $data, 1024);
echo "Done \n\n";
posix_mkfifo( $fifoPath , 0666)