alexevladgabriel / php-webrcon Goto Github PK
View Code? Open in Web Editor NEW๐ PHP library to send & receive commands from rust server based on websocket client.
License: GNU General Public License v3.0
๐ PHP library to send & receive commands from rust server based on websocket client.
License: GNU General Public License v3.0
Fatal error: Uncaught ErrorException: stream_socket_client(): Unable to connect to tcp: (Failed to parse address "tcp:") in /vendor/phrity/net-stream/src/SocketClient.php
Why does it say "tcp:"
, this is not what I provided as IP address..
First, thanks for this package. I tried several options and nothing worked at all.
Second, in the receive method, you are mapping over the response array and calling json_decode
on each value (line 76). This is changing any part of the response to null if the text isn't numeric or JSON. For example, the "Type" index is always null when the text returned from the response should say "Generic".
As for the title, there are several Rust commands that don't return JSON, but just raw text. For example, the stats
returns a list of all players connected and some stats about them (time, kills, deaths, etc). Any responses to those commands gets basically converted to null. So you basically can't use this class for rust commands without modification.
IMO, the message text should return the original text if a json_decode fails (returns null). I have personally modified the array map at lines 75-77 to...
// decode the response
$response = json_decode($this->client->receive(), true);
// decode the message as json or the original text if json decode failed
$response['Message'] = json_decode($response['Message']) ?? $response['Message'];
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.