Armax / Pokemon-GO-node-api

Pokemon GO api node.js library
MIT License
875 stars 198 forks source link

API Endpoint sometimes is null #112

Closed WiS3 closed 8 years ago

WiS3 commented 8 years ago

Hello, sometimes i get [i] Received API Endpoint: https://null/rpc I don't know how to reproduce it or what could be the cause, but it should be handled.

Currently when it happens, the server crashes on Heartbeat.

klisman commented 8 years ago

I got this sometimes, but i think was my modifications.

WiS3 commented 8 years ago

This is my implementation of the api. I have a WebSocket server and Go is unique for each connection, when the client connect i call Go.Connect(...); I don't think that there are issues with my code, because sometimes i get the correct end point. It is totally random.

var Go = {
    Status: GO_STATUS_DISCONNECTED,
    Instance: null,
    Connect: function(type, user, password, location){
        if(this.Status == GO_STATUS_CONNECTED || this.Status == GO_STATUS_CONNECTING){
            //TODO handle connected/connecting status
            return;
        }
        this.Instance = new PokemonGO.Pokeio();
        this.Status = GO_STATUS_CONNECTING;
        this.Instance.init(user,password,location,type,function(error){
            if(error){
                Go.Status = GO_STATUS_DISCONNECTED;
                throw error;
            }else{
                Go.Status = GO_STATUS_CONNECTED;
            }
        });
    },
    FetchPokemons: function(){
        if(this.Status == GO_STATUS_CONNECTED){
            this.Instance.Heartbeat(function (err, hb) {
                // ........
            }
        }
    }
}
Armax commented 8 years ago

we are fixing the GetApiEndpoint function, the https://null/rpc is caused by niantic's servers problem

WiS3 commented 8 years ago

@Armax Please reopen the issue because is still not fixed. As someone else said, issues should not be closed until fixed or figured out.

gallexme commented 8 years ago

the https://null/rpc is caused by niantic's servers problem

WiS3 commented 8 years ago

@gallexme I know that. But it should at least be handled and throw an error when it happens.