WebSocket connection to 'ws://localhost:35729/livereload' Failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED chromereload.js:9 'WebSocket.URL' is deprecated. Please use 'WebSocket.url' instead. chromereload.js:12
我在Chrome扩展程序中收到此错误消息,因为chrome更新到版本38.我不太清楚这里是什么,但现在打开大多数东西会导致扩展崩溃.我一开始就用自耕农来支撑我的项目,一切都很好.我尝试从清单中删除livereload,但这似乎打破了一切.任何帮助,将不胜感激.
这是代码:
'use strict'; // Reload client for Chrome Apps & Extensions. // The reload client has a compatibility with livereload. // WARNING: only supports reload command. var LIVERELOAD_HOST = 'localhost:'; var LIVERELOAD_PORT = 35729; var connection = new WebSocket('ws://' + LIVERELOAD_HOST + LIVERELOAD_PORT + '/livereload'); connection.onerror = function (error) { console.log('reload connection got error' + JSON.stringify(error)); }; connection.onmessage = function (e) { if (e.data) { var data = JSON.parse(e.data); if (data && data.command === 'reload') { chrome.runtime.reload(); } } };