1. Go to this page and download the library: Download evan-li/think-gateway library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
evan-li / think-gateway example snippets
namespace app\worker\controller;
use think\gateway\Server;
class Starter extends Server
{
}
class Starter extends Server
{
protected $businessEventHandler = 'app\worker\util\EventsHandler';
}
namespace app\worker\util;
use think\gateway\Events;
class EventsHandler extends Events
{
public static function processMessage($client_id, $message)
{
parent::processMessage($client_id, $message); // do some thing
}
}