# elephant.io **Repository Path**: msd8/elephant.io ## Basic Information - **Project Name**: elephant.io - **Description**: Elephant.io is a rough websocket client written in PHP. - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2020-10-14 - **Last Updated**: 2022-01-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Elephant.io =========== ``` ___ _,.--.,_ Elephant.io is a rough websocket client .-~ ~--"~-. ._ "-. written in PHP. Its goal is to ease the / ./_ Y "-. \ communications between your PHP Application and Y :~ ! Y a real-time server. lq p | / .| _ \. .-, l / |j Requires PHP 5.4 and openssl, licensed under ()\___) |/ \_/"; ! the MIT License. \._____.-~\ . ~\. ./ Y_ Y_. "vr"~ T Built-in Engines : ( ( |L j - Socket.io 2.x [nn[nn..][nn..] - Socket.io 1.x ~~~~~~~~~~~~~~~~~~~ - Socket.io 0.x (courtesy of @kbu1564) ``` 安装:composer require wisembly/elephant.io 如thinkphp框架,把文件夹redis放入extend目录下,在控制器中使用如: ``` "def", "contractStats" => 0, "memberId" => "1e1e8f5f2569b3e163400b8e61be211a", "event" => "subscribe", "uuid" => rand(1000,9999), "params" => ['600519'] ); $client = new Client(new Version2X($url)); $client->initialize(); $client->emit('/contractList', $data); while (true) { $client->emit('1',[]); $r = $client->read(); if (strlen($r)>50) { $d = substr($r, strpos($r, '[')); dump($d); } } $client->close(); } } ``` 实例可参考example目录文件