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

Array mpc as service demo transformed to be a cypress test #277

Merged
merged 15 commits into from
Apr 30, 2024

Conversation

Snafkin547
Copy link
Contributor

No description provided.

@Snafkin547
Copy link
Contributor Author

I found out the issue around socket connection due to the socket.io version update.

Upon socket connection, JIFF register a callback, handlers.connect in client/socket/event.js #L11

this.socket.on('connect', jiffClient.handlers.connected);

After required number of all sockets are connected, it gets triggered by jiff-client-restful.js (This example uses restful extension instead of websockets).

    jiff.socket.connect = function () {
      var connectListeners = jiff.socket.listeners('connect');
      for (var i = 1; i < connectListeners.length; i++) {
        connectListeners[i]();
      }
    };

This implementation worked fine in socket v2.5.0, because this.socket.on('connect', jiffClient.handlers.connected); registered the callbacks twice for a single connection for some reason.

However, from v3 onward (we are currently using v4), it is no longer the case and this weird behavior has been corrected. The resulting listener array only contains 1 callback from itself.

Therefore, I changed the starting index from i = 1 to i = 0, so that the only 'on connect' listener call back gets executed as intended:

      for (var i = 0; i < connectListeners.length; i++) {
        connectListeners[i]();
      }

@Snafkin547 Snafkin547 merged commit af8ecbe into master Apr 30, 2024
4 of 33 checks passed
@Snafkin547 Snafkin547 deleted the arr-mpc-as branch April 30, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants