gpt4 book ai didi

Javascript - socket.io get 显示未找到

转载 作者:太空宇宙 更新时间:2023-11-04 02:58:18 25 4
gpt4 key购买 nike

我收到错误:/socket.io/1/?t=1410234556010 404(未找到)

  Socket.prototype.handshake = function (fn) {
var self = this
, options = this.options;

function complete (data) {
if (data instanceof Error) {
self.connecting = false;
self.onError(data.message);
} else {
fn.apply(null, data.split(':'));
}
};

var url = [
'http' + (options.secure ? 's' : '') + ':/'
, options.host + ':' + options.port
, options.resource
, io.protocol
, io.util.query(this.options.query, 't=' + +new Date)
].join('/');

if (this.isXDomain() && !io.util.ua.hasCORS) {
var insertAt = document.getElementsByTagName('script')[0]
, script = document.createElement('script');

script.src = url + '&jsonp=' + io.j.length;
insertAt.parentNode.insertBefore(script, insertAt);

io.j.push(function (data) {
complete(data);
script.parentNode.removeChild(script);
});
} else {
var xhr = io.util.request();

xhr.open('GET', url, true);
if (this.isXDomain()) {
xhr.withCredentials = true;
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
xhr.onreadystatechange = empty;

if (xhr.status == 200) {
complete(xhr.responseText);
} else if (xhr.status == 403) {
self.onError(xhr.responseText);
} else {
self.connecting = false;
!self.reconnecting && self.onError(xhr.responseText);
}
}
};
xhr.send(null);
}
};

最佳答案

您需要将 socket.io.js 添加到您的客户端。

对于 HTML:

<script type="text/javascript" src="/socket.io/socket.io.js"></script>

对于 Jade :

script(type='text/javascript',src='/socket.io/socket.io.js')

关于Javascript - socket.io get 显示未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25736437/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com