Node.js 高速公路-发送非空';Sec WebSocket协议';标题错误
我正在尝试使用NodeJS、WAMP.io和websocket.io构建一个WAMP服务器。 以下是服务器端代码:Node.js 高速公路-发送非空';Sec WebSocket协议';标题错误,node.js,autobahn,Node.js,Autobahn,我正在尝试使用NodeJS、WAMP.io和websocket.io构建一个WAMP服务器。 以下是服务器端代码: var wsio = require('websocket.io'); var wamp = require('wamp.io'); var socketServer = wsio.listen(9000); var wampServer = wamp.attach(socketServer); <!doctype html> <html lang="en"&g
var wsio = require('websocket.io');
var wamp = require('wamp.io');
var socketServer = wsio.listen(9000);
var wampServer = wamp.attach(socketServer);
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Wamp Example</title>
</head>
<body>
<ul class="pages">
<li>
<button id="socket">Call</button>
</li>
</ul>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="https://autobahn.s3.amazonaws.com/autobahnjs/latest/autobahn.min.jgz">
</script>
<script>
AUTOBAHN_DEBUG = true;
</script>
<script>
var connection = new autobahn.Connection({
url: 'ws://localhost:9000/',
realm: 'realm1'
});
console.log(connection);
connection.onopen = function (session) {
console.log(session);
// session is an instance of autobahn.Session
};
connection.onclose = function(reason, detail){
console.log(reason);
}
connection.open();
</script>
</body>
</html>
我正在尝试使用AutobahnJS通过浏览器测试酒吧酒吧酒吧。以下是客户端代码:
var wsio = require('websocket.io');
var wamp = require('wamp.io');
var socketServer = wsio.listen(9000);
var wampServer = wamp.attach(socketServer);
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Wamp Example</title>
</head>
<body>
<ul class="pages">
<li>
<button id="socket">Call</button>
</li>
</ul>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="https://autobahn.s3.amazonaws.com/autobahnjs/latest/autobahn.min.jgz">
</script>
<script>
AUTOBAHN_DEBUG = true;
</script>
<script>
var connection = new autobahn.Connection({
url: 'ws://localhost:9000/',
realm: 'realm1'
});
console.log(connection);
connection.onopen = function (session) {
console.log(session);
// session is an instance of autobahn.Session
};
connection.onclose = function(reason, detail){
console.log(reason);
}
connection.open();
</script>
</body>
</html>
这部分代码返回“不可访问”
connection.onclose = function(reason, detail){
console.log(reason);
}
有我遗漏的代码吗?握手是WAMP v2,您的websocket服务器必须使用WAMP v1。我对棘轮也有同样的问题。看到握手的东西是WAMPv2,您的websocket服务器必须使用WAMPv1。我对棘轮也有同样的问题。看到握手的东西是WAMPv2,您的websocket服务器必须使用WAMPv1。我对棘轮也有同样的问题。看见