Open blackcatt opened 1 year ago
Help solve the problem. I need to access the binance websocket data, but I don't see a method to do this. Am I bad at searching? Or should I implement this method myself by modifying Mr. zhouaini's source code? something like this:
$binance=new BinanceWebSocket(); $binance->config([ ... ]); $binance->onMessage( function($data){ // my busines logic } ); $binance->start();
This mode is not supported temporarily because it is highly encapsulated. You can view the source code.
$binance->onMessage(
function($data){
// my busines logic
}
);
https://github.com/zhouaini528/binance-php/blob/master/src/Api/WebSocket/SocketServer.php#L102
You can modify the source code to see if it is the result you need.
function onMessage($global){
return function($con,$data) use($global){
//Here are all the data returned by the exchange
$data=json_decode($data,true);
print_r($data);
};
}
Help solve the problem. I need to access the binance websocket data, but I don't see a method to do this. Am I bad at searching? Or should I implement this method myself by modifying Mr. zhouaini's source code? something like this: