[fix] change file watcher port only in dev environment (#3232)

Fixes error https://discuss.erpnext.com/t/frappe-v8-0-20-later-socketio-error/22973
This commit is contained in:
Sagar Vora 2017-05-05 11:48:40 +05:30 committed by Nabin Hait
parent 8959be9b1c
commit da1ade6a97

View file

@ -196,10 +196,15 @@ frappe.socket = {
},
setup_file_watchers: function() {
var host = window.location.origin;
var port = '6787';
// remove the port number from string
host = host.split(':').slice(0, -1).join(":");
host = host + ':' + port;
if(window.dev_server) {
var port = '6787';
var parts = host.split(":");
// remove the port number from string if exists
if (parts.length > 2) {
host = host.split(':').slice(0, -1).join(":");
}
host = host + ':' + port;
}
frappe.socket.file_watcher = io.connect(host);
// css files auto reload