简体   繁体   English

'WebSocket.URL'已弃用。 请改用'WebSocket.url'

[英]'WebSocket.URL' is deprecated. Please use 'WebSocket.url' instead

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

I'm getting this error message in my chrome extension since chrome updated to version 38. I'm not quite sure whats going on here, but now opening most things causes the extension to crash. 我在Chrome扩展程序中收到此错误消息,因为chrome已更新到版本38.我不太清楚这里是什么,但现在打开大多数东西会导致扩展崩溃。 I used yeoman to scaffold my project at the beginning, and everything was working fine. 我一开始就用自耕农来支撑我的项目,一切都很好。 I tried removing livereload from the manifest, but that seems to break everything. 我尝试从清单中删除livereload,但这似乎打破了一切。 Any help would be appreciated. 任何帮助,将不胜感激。

Here is the code: 这是代码:

'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();
        }
    }
};

In Chrome this message is emitted when using something like JSON.stringify() or similar on a WebSocket object. 在Chrome中,当在WebSocket对象上使用类似JSON.stringify()或类似内容的东西时会发出此消息。 These kind of routines will access the WebSocket.URL property, which is deprecated, and emit this warning. 这些例程将访问不推荐使用的WebSocket.URL属性,并发出此警告。 Even if your code doesn't explicitly call WebSocket.URL. 即使您的代码没有显式调用WebSocket.URL。 You can delete this property to mute the warning from Chrome. 您可以删除此属性以将来自Chrome的警告静音。

var ws = new WebSocket('wss://example.com/');
delete ws.URL;
console.log(JSON.stringify(ws));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 已弃用“ webkitMovementX”。 请改用“ movementX” - 'webkitMovementX' is deprecated. Please use 'movementX' instead 不推荐使用globalstorage。 请改用localstorage - use of globalstorage is deprecated. please use localstorage instead 请帮忙! -不推荐使用event.returnValue。 请改用标准event.preventDefault() - Please help! - event.returnValue is deprecated. Please use the standard event.preventDefault() instead 不推荐使用XMLHttpRequest进度事件属性“position”。 请改用'已加载' - The XMLHttpRequest progress event property 'position' is deprecated. Please use 'loaded' instead event.returnValue已弃用。 请改用标准event.preventDefault() - event.returnValue is deprecated. Please use the standard event.preventDefault() instead 不推荐使用getPreventDefault()。请改用defaultPrevented - Use of getPreventDefault() is deprecated. Use defaultPrevented instead 不推荐为 MessageEmbed#setAuthor 传递 URL 或图标的 URL 的字符串。 通过一个唯一的 object 代替 - Passing strings for the URL or the icon's URL for MessageEmbed#setAuthor is deprecated. Pass a sole object instead “ Attr.nodeValue”已弃用。 请使用“值”代替adsbygoogle.js:27 - 'Attr.nodeValue' is deprecated. Please use 'value' instead adsbygoogle.js:27 不推荐使用getAttributeNodeNS()。 请改用getAttributeNS() - Use of getAttributeNodeNS() is deprecated. Use getAttributeNS() instead WebSocket URL变量未定义 - WebSocket URL variable is not defined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM