Skip to content

Instantly share code, notes, and snippets.

@dam1r89
Created September 4, 2016 10:05
Show Gist options
  • Save dam1r89/9e45952853c3874e5ba3865a2825277f to your computer and use it in GitHub Desktop.
Save dam1r89/9e45952853c3874e5ba3865a2825277f to your computer and use it in GitHub Desktop.
<?php
use Workerman\Lib\Timer;
use Workerman\Worker;
require __DIR__ . '/bootstrap/autoload.php';
Timer::add(0.1, function () {
echo "First timer\n";
Timer::add(0.1, function () {
echo "Second timer\n";
$udpWorker = new Worker("udp://0.0.0.0:15123");
$udpWorker->onMessage = function ($connection, $data) {
echo "Received $data\n";
};
}, null, false);
Timer::add(3, function () {
echo "Third timer\n" ;
}, null, false);
}, null, false);
\Workerman\Worker::runAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment