Server question (message either not broadcasting or not being received)

Hi There,

I’m working on a “persistent multiplayer vr server” a la @Josip_Almasi 's vrspace (but far less sophisticated). I am having some problems with an interactivity component, and I wonder if anyone would be open to giving it a look.

Here is where the code is hosted: Glitch :・゚✧

The problem is as follows. On the server, I receive a message from the client that a cube in the space has been moved. That works.

    socket.on("changedCube", function(data){
      //changing the server's internal representation;
      //I think this is so that when someone logs in it looks correct;
      var position = data;
      //telling all of the clients to update their cube registry;
      socket.emit("clientChangedCube", position);

The problem is that that last line "socket.emi(“clientchangedCube etc.” either (1.) isn’t broadcasting to all the clients? or (2.) isn’t being received (I mean, it’s definitely not being received).

Here is the client code.

     //this message is not being received (!);
        socket.on("clientChangedCube", function(data){
          //serverData[data][1] = 1;
          //serverBoxes[data].position.y = 1;

So, what’s going on here? Other messages are happy going back and forth? I’ve checked my commas and error logs a million times. What am I doing wrong? I am very close to having a “persistent multiplayer vr sketch” that is available to anyone in our community, open source, and remixable at the click of a button!

socket.emit sends the message to the referenced “socket” connection.
io.emit sends the message to all connected clients

Could this be it?

1 Like

This could be it… I’ll double check tmrw but great lead.

thanks for saving. my. ass. +++