- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在这里运行了这个例子:https://github.com/crossbario/crossbarexamples/tree/master/wss/python ,一切正常。
但是,以下情况对我不起作用:
config.json 文件:
{
"controller": {},
"workers": [
{
"type": "router",
"realms": [
{
"name": "realm1",
"roles": [
{
"name": "anonymous",
"permissions": [
{
"uri": "*",
"publish": true,
"subscribe": true,
"call": true,
"register": true
}
]
}
]
}
],
"transports": [
{
"type": "web",
"endpoint": {
"type": "tcp",
"port": 9000,
"tls": {
"key": "server_key.pem",
"certificate": "server_cert.pem",
"dhparam": "dhparam.pem",
"ciphers": "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5:!DSS"
}
},
"paths": {
"/": {
"type": "static",
"directory": "../web"
},
"ws": {
"type": "websocket"
}
}
}
]
}
]
}
web/index.html 文件只是为了查看 TLS 是否有效:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Router</title>
</head>
<body>
This is a router.
</body>
</html>
我生成了证书,如果我连接到 https://127.0.0.1:9000
网站,一切正常。页面加载正确。
但是,我在 node.js 中设置了另一个项目来尝试注册某些内容..(代码取自页面加载计数示例)
server.js
中的代码:
var connection = new autobahn.Connection({
url: 'wss://127.0.0.1:9000/ws',
realm: 'realm1'}
);
connection.onopen = function (session) {
console.log("connected to WAMP router");
app.session = session;
// REGISTER a procedure for remote calling
//
function get_visits () {
return app.visits;
}
session.register('com.example.get_visits', get_visits).then(
function (reg) {
console.log("procedure get_visits() registered");
},
function (err) {
console.log("failed to register procedure: " + err);
}
);
};
connection.onclose = function (reason, details) {
console.log("WAMP connection closed", reason, details);
app.session = null;
}
connection.open();
现在,wss://127.0.0.1:9000/ws
是路由器的正确 URL,但我总是收到以下内容:
WAMP connection closed unreachable { reason: null,
message: null,
retry_delay: 1.8090544409276008,
retry_count: 1,
will_retry: true }
无法连接到服务器。
我确信我没有掌握一些基本概念,也许你可以引导我走向正确的方向。
最佳答案
如果您使用自签名证书,则需要告诉浏览器信任它,否则连接将在 TLS 层失败。
我最近在“crossbarexamples”存储库中添加了客户端证书支持和完整的示例:https://github.com/crossbario/crossbarexamples/tree/master/authenticate/client_tls
在上面链接的示例中,您可以将中间 CA 证书导入到您的浏览器(或自签名根 CA 证书)。
关于autobahn - 无法使用 TLS 连接到 Crossbar 路由器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33938251/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!