Gateway::sendToClient
$client_id
$send_data
use \GatewayWorker\Lib\Gateway;
{
...
public static function onMessage($client_id, $message)
{
// $message = '{"type":"say_to_one","to_client_id":100,"content":"hello"}'
$req_data = json_decode($message, true);
if($req_data['type'] == 'say_to_one')
// 转发消息给对应的客户端
Gateway::sendToClient($req_data['to_client_id'], $req_data['content']);
}
}