I ran the example here: https://github.com/crossbario/crossbarexamples/tree/master/wss/python, and everything works fine.
However, the following case does not work for me:
The config.json file:
{
"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"
}
}
}
]
}
]
}
The web/index.html file is just to see if the TLS works:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Router</title>
</head>
<body>
This is a router.
</body>
</html>
I generated the certificate and everything works well if I connect to the website at https://127.0.0.1:9000
. The page loads correctly.
However, I set up another project in node.js to try to register something.. (code taken from the page load count example)
The code in 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();
Now, wss://127.0.0.1:9000/ws
is the correct URL for the router, however I always receive the following:
WAMP connection closed unreachable { reason: null,
message: null,
retry_delay: 1.8090544409276008,
retry_count: 1,
will_retry: true }
It can't connect to the server.
I am sure some basic concepts are escaping me, perhaps you can lead me in the right direction.