Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client keeps getting "undefined" socket.io #194

Open
mautematico opened this issue Oct 27, 2015 · 5 comments
Open

Client keeps getting "undefined" socket.io #194

mautematico opened this issue Oct 27, 2015 · 5 comments

Comments

@mautematico
Copy link

  1. Start server and client from master
    c3a960b
  2. Let's some players enter the game.
  3. Wait some random time.
  4. Current (and future) players are now playing alone, with no NPC and with no other players.

screenshot from 2015-10-26 18 21 17

I noticed you are using v1.4 in your heroku server, and I noticed 1.4 is not using socket.io; so maybe there are some issues with socket.io migration?

@mautematico
Copy link
Author

@Flavius256 I think you migrated your fork to socket.io as well. May be do you have some useful information about this?

Thank you!

@ghost
Copy link

ghost commented Oct 27, 2015

Of course I do ;)

The main issue is that socket.io and BQ are not properly 'merged' together, so some packets of type undefined or null get sent, that causes all the monsters and group entities to disappear..

I won't keep the temporary fix for myself, so here's what I've done to prevent this until I find out what packets are being undefined.

    processQueues: function() {
        var self = this,
            connection;

        for(var id in self.outgoingQueues) {
            if (id != null && typeof id !== 'undefined') {
                if (self.outgoingQueues.hasOwnProperty(id)) {
                    if (self.outgoingQueues[id].length > 0 && typeof self.outgoingQueues[id] !== 'undefined' && self.outgoingQueues[id] != null) {
                        if (self.server.getConnection(id) != null && typeof self.server.getConnection(id) !== 'undefined') {
                            connection = self.server.getConnection(id);
                            connection.send(self.outgoingQueues[id]);
                            self.outgoingQueues[id] = [];
                            //log.info("Sent ID: " + id + " successfully.");
                        } else {
                            delete self.server.getConnection(id);

                        }
                    }
                }
            } else {
                //log.info("ID is null");
            }
        }
    },

mautematico added a commit to Creepypastas/BrowserQuest that referenced this issue Oct 27, 2015
@mautematico
Copy link
Author

@Flavius256 thank you!
I'm trying your fix. There are something odd with it, I think.

now, /status displays [] or [2] (where 2 the number of online players) instead of, let's say [2,0,0,0,0]

I'm using node v0.10.40

Again, thank you for your fix. I'll test it some time and then I'll let you know if I found something else.

@ghost
Copy link

ghost commented Oct 27, 2015

Each object in the array [2, 0, 0, 0, 0] is the world with its players. It should never be completely empty unless there are 0 worlds. [0] for 0 players, [2] for two players in a single world.

@mautematico
Copy link
Author

Then it's my fault. I configured server/config.json for a single world, but I forgot that. 😅
Thank you, again!

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

No branches or pull requests

1 participant