pushrax / node-rcon

A generic RCON protocol client for node.js
MIT License
134 stars 31 forks source link

Uncaught TypeError: o.createConnection is not a function #20

Closed germanllop closed 5 years ago

germanllop commented 5 years ago

Hi, I'm trying to use Vue (Webpack) to connect via rcon to some servers, there is an issue when I launch the connect() function: Uncaught TypeError: o.createConnection is not a function

Here is my code:

import Rcon from "rcon"

let options = { tcp: true, // false for UDP, true for TCP (default true) challenge: true // true to use the challenge protocol (default true) }

const server = new Rcon(this.ip, this.port, this.rcon_password,options) console.log(server.connect())

Before the server.connect() if I log the server variable, the object was created succesfully.

pushrax commented 5 years ago

Which version of Node.js are you running? The referenced function is this one https://nodejs.org/api/net.html#net_net_createconnection

germanllop commented 5 years ago

I'm using the latest 11.4.0. Thanks.

I found the problem, I was trying to do it from the browser (Vue) it doesn't allow that level of connections, so I need to use a websocket.

pushrax commented 5 years ago

Yeah, you'll need to proxy through a server.