Hi guys,
I have an electron app from which I am trying to connect to a crossbar router. It was working these last days. I updated some packages and since I am not able to connect to the router anymore.
I started a new project to try the basic crossbar example but nothing is working anymore.
I am using autobahn js 0.10.1 with electron 1.2.3. Here is my package.json:
{
"name": "ProjectName",
"version": "0.1.0",
"main": "./main.js",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron-prebuilt": "^1.2.3"
},
"dependencies": {
"autobahn": "^0.10.0"
}
}
and main.js
'use strict';
const autobahn = require('autobahn');
console.log("Ok, Autobahn loaded", autobahn.version);
var wp_connection = new autobahn.Connection({
realm: "realm1"
});
wp_connection.onopen = function (session) {
console.log("Wamp socket connected");
}
wp_connection.open();
The config.json
{
"version": 2,
"controller": {},
"workers": [
{
"type": "router",
"realms": [
{
"name": "realm1",
"roles": [
{
"name": "anonymous",
"permissions": [
{
"uri": "*",
"allow": {
"call": true,
"register": true,
"publish": true,
"subscribe": true
},
"disclose": {
"caller": false,
"publisher": false
},
"cache": true
}
]
}
]
}
],
"transports": [
{
"type": "web",
"endpoint": {
"type": "tcp",
"port": 8080
},
"paths": {
"/": {
"type": "static",
"directory": ".."
},
"wp": {
"type": "websocket"
}
}
}
]
}
]
}
I got the following debug message from crossbar :
2016-06-17T19:22:42+0200 [Router 1550 crossbar.router.session.RouterSession] Client session connected - transport: {u'cbtid': None, u'protocol': 'wamp.2.json', u'http_headers_received': {u'upgrade': u'websocket', u'sec-websocket-extensions': u'permessage-deflate; client_max_window_bits', u'sec-websocket-version': u'13', u'sec-websocket-protocol': u'wamp.2.json', u'connection': u'Upgrade', u'sec-websocket-key': u'MTMtMTQ2NjE4NDE2MjI3MQ==', u'host': u'127.0.0.1:8080'}, u'peer': u'tcp4:127.0.0.1:52295', u'http_headers_sent': {}, u'type': 'websocket'}
2016-06-17T19:22:42+0200 [Router 1550 crossbar.router.protocol.WampWebSocketServerProtocol] dropping connection: None
2016-06-17T19:22:42+0200 [Router 1550 crossbar.router.protocol.WampWebSocketServerProtocol] Connection to/from tcp4:127.0.0.1:52295 was closed cleanly
2016-06-17T19:22:42+0200 [Router 1550 crossbar.router.protocol.WampWebSocketServerProtocol] _connectionLost: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
]
So basically I am able to connect to the router but them the connection is directly closed. However, the same code is working in the browser.
I could use some help on this one. Any ideas ?
Do you need other informations ?
Thank you all