GithubHelp home page GithubHelp logo

alexevladgabriel / php-webrcon Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 66 KB

๐Ÿ˜ PHP library to send & receive commands from rust server based on websocket client.

License: GNU General Public License v3.0

PHP 100.00%
php rcon webrcon

php-webrcon's People

Contributors

alexevladgabriel avatar dependabot[bot] avatar github-actions[bot] avatar limmek avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

victorn3ss limmek

php-webrcon's Issues

Unable to get response from Rust commands

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'];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.