Hello, I am trying to develop a web application that allows me to type commands in the Rcon console via the web Browser.
The problem is that every time I send a command I get “[Rcon] Failed to parse message, incorrect format”.
After hours looking for information, I have not found anything to help me. I would appreciate help.
Here is the code:
> <!DOCTYPE html>
> <html lang="en">
> <head>
> <meta charset="UTF-8">
> <meta name="viewport" content="width=device-width, initial-scale=1.0">
> <title>WebSocket</title>
> </head>
> <body>
> <h1>WebSockets Rust Server</h1>
> <input type="button" value="Send" onclick="webSocketTest();">
>
> <script>
> function webSocketTest() {
> const rcon = new WebSocket('ws://localhost:28016/1234');
> console.log(rcon);
>
> rcon.onopen = function(e) {
> rcon.send('status');
> }
>
> rcon.onmessage = function(e) {
> // Code
> }
>
> rcon.onerror = function(e) {
> // Code
> }
>
> rcon.onclose = function(e) {
> // Code
> }
> }
> </script>
> </body>
> </html>