Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Unable to connect to local server ( http://agar.io/?ip=127.0.0.1:443 ) #702

Open
harlos0517 opened this issue May 30, 2017 · 5 comments
Open

Comments

@harlos0517
Copy link

What I've done: (all on Win 10, with latest npm and node version)

  • Git cloned the Ogar repo
  • run "Install Dependencies.bat"
  • run "Start-windows.bat"
    which showed:
[Game] Ogar - An open source Agar.io server implementation
[Game] Loaded 0 plugin(s)
[Game] Loaded stats server on port 88
[Game] Listening on port 443
[Game] Current game mode is Free For All
>
TypeError: Cannot read property 'headers' of undefined
    at GameServer.connectionEstablished (D:\projects\Ogar\src\GameServer.js:219:35)
    at emitTwo (events.js:106:13)
    at WebSocketServer.emit (events.js:191:7)
    at handleUpgrade (D:\projects\Ogar\node_modules\ws\lib\WebSocketServer.js:88:16)
    at WebSocketServer.completeUpgrade (D:\projects\Ogar\node_modules\ws\lib\WebSocketServer.js:270:5)
    at WebSocketServer.handleUpgrade (D:\projects\Ogar\node_modules\ws\lib\WebSocketServer.js:197:10)
    at Server.WebSocketServer._ultron.on (D:\projects\Ogar\node_modules\ws\lib\WebSocketServer.js:87:14)
    at emitThree (events.js:116:13)
    at Server.emit (events.js:194:7)
    at onParserExecuteCommon (_http_server.js:409:14)

So I go check the code of GameServer.js and found this

        // ----- Client authenticity check code -----
        // !!!!! WARNING !!!!!
        // BLAHBLAHBLAHBLAH( I skipped the whole paragraph
        var origin = ws.upgradeReq.headers.origin;  // Line 219
        if ((origin != 'http://agar.io' &&
            origin != 'https://agar.io' &&
            origin != 'http://localhost' &&
            origin != 'https://localhost' &&
            origin != 'http://127.0.0.1' &&
            origin != 'https://127.0.0.1') && this.config.serverDiscardForeignClients >= 1) {

            ws.close();
            return;
        }
        // -----/Client authenticity check code -----
  • I simply remove this part of code regardless of the lengthy warning.
  • And I tried again: http://agar.io/?ip=127.0.0.1:443 in Google Chrome
    It still kept showing Connecting, but this time there is no error message in the server command line.
    (The console on Chrome showed no error message.)
    I tried a few commands like Addbot 10 and it showed
    [Console] Added 10 player bots
    which seems to imply that the server IS still working.

I tried to search through both the issues here and the Net but in vain.
So there are actually two problems here:

  1. When trying to connect to server, in server command line
TypeError: Cannot read property 'headers' of undefined
at GameServer.connectionEstablished (D:\projects\Ogar\src\GameServer.js:219:35)

where in GameServer.js
var origin = ws.upgradeReq.headers.origin;
P.S. A friend of mine tried the same method on Ubuntu 16.04 and showed the same error.

  1. (After simply remove the related code mentioned above)
    When trying to connect to server, it kept showing Connecting, but no error message in the server command line.
    P.S. Ubuntu 16.04 works fine (after removing the code).

I would appreciate it very much if anybody could help, because my team wants to use this in a student conference on June 11th.

@freaky767
Copy link

I would not suggest using Ogar, as it is very obsolete.
If you want a project, which is still worked on, and has many features, I shall suggest:
https://github.com/Megabyte918/MultiOgar-Edited

@freaky767
Copy link

I may add, MultiOgar-Edited also is compatible with the latest Agar.io Client.

@Luka967
Copy link
Collaborator

Luka967 commented May 30, 2017

^ this.

@ialexsip
Copy link

gameserver.js is at Ogar-master\src. Edit it with notepad++ and comment ( // ) from line 219 to 229

@jaydenSPC
Copy link

@freaky767 with multiogar when i control my minions and make them eject mass, everyone dies. why?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants