Skip to content

use relative path for socket.io#1937

Merged
MichMich merged 3 commits intoMagicMirrorOrg:developfrom
Legion2:develop
Mar 24, 2020
Merged

use relative path for socket.io#1937
MichMich merged 3 commits intoMagicMirrorOrg:developfrom
Legion2:develop

Conversation

@Legion2
Copy link
Contributor

@Legion2 Legion2 commented Feb 18, 2020

This Pull Request fix #1934

  • It changes the javascript include path of the /socket.io/socket.io.js to a relative one, like all the other scripts
  • It appends the path of the current window to the path of the socket.io endpoint

@Legion2
Copy link
Contributor Author

Legion2 commented Feb 29, 2020

@MichMich should I rebase the PR?

@khassel
Copy link
Collaborator

khassel commented Mar 24, 2020

@MichMich can we get this merged before the new release next week? Or why are you hesitating?

@MichMich MichMich merged commit 7ac97f8 into MagicMirrorOrg:develop Mar 24, 2020
@MichMich
Copy link
Collaborator

Merged.

@RoadRunnr1469
Copy link

I don't understand what you mean by "Remove additional slash from path" below I'm tasing my socket client.js

var MMSocket = function(moduleName) {
var self = this;

    if (typeof moduleName !== "string") {
            throw new Error("Please set the module name for the MMSocket.");
    }

    self.moduleName = moduleName;

    // Private Methods
    self.socket = io("/" + self.moduleName, {
            path: window.location.pathname + "socket.io"
    });
    var notificationCallback = function() {};

    var onevent = self.socket.onevent;
    self.socket.onevent = function(packet) {
            var args = packet.data || [];
            onevent.call(this, packet); // original call
            packet.data = ["*"].concat(args);
            onevent.call(this, packet); // additional call to catch-all
    };

    // register catch all.
    self.socket.on("*", function(notification, payload) {
            if (notification !== "*") {
                    notificationCallback(notification, payload);
            }
    });

    // Public Methods
    this.setNotificationCallback = function(callback) {
            notificationCallback = callback;
    };

    this.sendNotification = function(notification, payload) {
            if (typeof payload === "undefined") {
                    payload = {};
            }
            self.socket.emit(notification, payload);
    };

};

@Legion2 Legion2 mentioned this pull request Apr 5, 2020
@Legion2
Copy link
Contributor Author

Legion2 commented Apr 5, 2020

@MichMich @RoadRunnr1469 I created a PR #1976 which reverts the path to its old default, but it can be changed in the config.

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

Successfully merging this pull request may close these issues.

5 participants