3000 explained code solutions for 75 technologies


php-swooleWebsocket client example


include 'client.php';
$w = new WebSocketClient('127.0.0.1', 9504);
$w->connect();
$w->send('test');
echo $w->recv();ctrl + c
client.php

include example websocket implementation based on Swoole

WebSocketClient

websocket wrapper class

'127.0.0.1', 9504

websocket server to connect to

connect()

connect to server

send('test')

send some message to server

echo $w->recv()

get response from server and print it