Openssl 使用JavaScript连接到Crossbar服务器会出现“与另一端的连接以非干净方式丢失”错误

Openssl 使用JavaScript连接到Crossbar服务器会出现“与另一端的连接以非干净方式丢失”错误,openssl,autobahn,crossbar,wamp-protocol,autobahnjs,Openssl,Autobahn,Crossbar,Wamp Protocol,Autobahnjs,我一直在尝试使用Autobahn(JavaScript)和Crossbar制作一个简单的基于WAMP RPC的应用程序。该脚本在安全连接和非安全连接中都不起作用 Crossbarconfig.json:- { "$schema": "https://raw.githubusercontent.com/crossbario/crossbar/master/crossbar.json", "version": 2,

我一直在尝试使用Autobahn(JavaScript)和Crossbar制作一个简单的基于WAMP RPC的应用程序。该脚本在安全连接和非安全连接中都不起作用

Crossbar
config.json
:-

{
    "$schema": "https://raw.githubusercontent.com/crossbario/crossbar/master/crossbar.json",
    "version": 2,
    "controller": {
    },
    "workers": [
        {
            "type": "router",
            "realms": [
                {
                    "name": "name_1",
                    "roles": [
                        {
                            "name": "anonymous",
                            "permissions": [
                                {
                                    "uri": "",
                                    "match": "prefix",
                                    "allow": {
                                        "call": true,
                                        "register": true,
                                        "publish": true,
                                        "subscribe": true
                                    },
                                    "disclose": {
                                        "caller": false,
                                        "publisher": false
                                    },
                                    "cache": false
                                }
                            ]
                        }
                    ]
                }
            ],
            "transports": [
                {
                    "type": "websocket",
                    "endpoint": {
                        "type": "tcp",
                        "port": 8080,
                        "tls": {
                            "key": "path/to/letsencrypt/keys/privkey.pem",
                            "certificate": "path/to/letsencrypt/keys/cert.pem",
                            "chain_certificates": ["path/to/letsencrypt/keys/chain.pem"],
                            "ca_certificates": [
                                "isrgrootx1.pem",
                                "letsencryptauthorityx1.pem",
                                "letsencryptauthorityx2.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"
                        }
                    },
                    "url": "wss://[domain]",
                    "serializers": ["json"],
                    "auth": {
                        "ticket": {
                            "type": "static",
                            "principals": {
                                "user_1": {
                                    "ticket": "ticket_1",
                                    "role": "anonymous"
                                }
                            }
                        }
                    },
                    "options": {
                        "allowed_origins": ["*"],
                        "allow_null_origin": true,
                        "enable_webstatus": true,
                        "max_frame_size": 1048576,
                        "max_message_size": 1048576,
                        "auto_fragment_size": 65536,
                        "fail_by_drop": true,
                        "open_handshake_timeout": 2500,
                        "close_handshake_timeout": 1000,
                        "auto_ping_interval": 10000,
                        "auto_ping_timeout": 5000,
                        "auto_ping_size": 4,
                        "compression": {
                            "deflate": {
                                "request_no_context_takeover": false,
                                "request_max_window_bits": 13,
                                "no_context_takeover": false,
                                "max_window_bits": 13,
                                "memory_level": 5
                            }
                        }
                    }
                },
                {
                    "type": "websocket",
                    "endpoint": {
                        "type": "tcp",
                        "port": 8081
                    },
                    "url": "ws://[domain]",
                    "serializers": ["json"],
                    "options": {
                        "allowed_origins": ["*"],
                        "allow_null_origin": true,
                        "enable_webstatus": false,
                        "max_frame_size": 1048576,
                        "max_message_size": 1048576,
                        "auto_fragment_size": 65536,
                        "fail_by_drop": true,
                        "open_handshake_timeout": 2500,
                        "close_handshake_timeout": 1000,
                        "auto_ping_interval": 10000,
                        "auto_ping_timeout": 5000,
                        "auto_ping_size": 4,
                        "compression": {
                            "deflate": {
                                "request_no_context_takeover": false,
                                "request_max_window_bits": 13,
                                "no_context_takeover": false,
                                "max_window_bits": 13,
                                "memory_level": 5
                            }
                        }
                    }
                }
            ]
        }
    ]
}
JavaScript:-

var connection=null;
AUTOBAHN_DEBUG = true;

require.config({
  baseUrl: ".",
  paths: {
      "autobahn":
         "https://[domain]/path/to/autobahn.min.js",
      "when": "https://cdnjs.cloudflare.com/ajax/libs/when/2.7.1/when"
  },
  shim: {
      "autobahn": {
          deps: ["when"]
      }
  }
});
    
require(["autobahn"], function(autobahn) {
  console.log("Ok, Autobahn loaded", autobahn.version);

  var connection = new autobahn.Connection({
    transports: [{
       type: 'websocket',
       port: '8080',
       host: '[domain]',
       url: "wss://[domain]:8080",
    }],
    realm: "name_1",
    max_retries: "0"
  });

  connection.onopen = function (session, details) {
     // Publish, Subscribe, Call and Register
      // session.register('com.myapp.add2', add2);
      // session.call('com.myapp.add2', [2, 3]).then(function showSum(res) {
      //    console.log('sum is', res);
      // }, session.log);
      console.log("Connection opened.");
  };


  connection.onclose = function (reason, details) {
     console.log("Connection closed.");
  }

  connection.open();
});
安全连接的交叉杆跟踪:-

[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] connection accepted from peer tcp4:[ip_address]:6589
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] Connection made to tcp4:[ip_address]:6589
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] Connection to/from tcp4:[ip_address]:6589 was lost in a non-clean fashion: Connection to the other side was lost in a non-clean fashion: Connection lost.
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] _connectionLost: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionLost'>: Connection to the other side was lost in a non-clean fashion: Connection lost.
autobahn.min.js:90 trying to create WAMP transport of type: websocket
autobahn.min.js:90 using WAMP transport type: websocket
autobahn.min.js:181 WebSocket connection to 'wss://[domain]:8080/' failed: WebSocket opening handshake was canceled
autobahn.min.js:87 connection closed unreachable {reason: null, message: null, retry_delay: null, retry_count: null, will_retry: false}
main.js:43 Connection closed.
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] connection accepted from peer tcp4:[ip_address]:7110
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] Connection made to tcp4:[ip_address]:7110
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] dropping connection to peer tcp4:[ip_address]:7110 with abort=True: WebSocket opening handshake timeout (peer did not finish the opening handshake in time)
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] Connection to/from tcp4:[ip_address]:7110 was aborted locally
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] _connectionLost: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally using ITCPTransport.abortConnection.
autobahn.min.js:90 using WAMP transport type: websocket
autobahn.min.js:181 WebSocket connection to 'ws://[domain]:8081/' failed: Error in connection establishment: net::ERR_CONNECTION_RESET
autobahn.min.js:87 connection closed unreachable {reason: null, message: null, retry_delay: null, retry_count: null, will_retry: false}
main.js:43 Connection closed.
非安全连接的Crossbar和Javascript代码相同,只是端口为
8081
,并将
wss
更改为
ws

不安全连接的纵横制跟踪:-

[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] connection accepted from peer tcp4:[ip_address]:6589
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] Connection made to tcp4:[ip_address]:6589
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] Connection to/from tcp4:[ip_address]:6589 was lost in a non-clean fashion: Connection to the other side was lost in a non-clean fashion: Connection lost.
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] _connectionLost: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionLost'>: Connection to the other side was lost in a non-clean fashion: Connection lost.
autobahn.min.js:90 trying to create WAMP transport of type: websocket
autobahn.min.js:90 using WAMP transport type: websocket
autobahn.min.js:181 WebSocket connection to 'wss://[domain]:8080/' failed: WebSocket opening handshake was canceled
autobahn.min.js:87 connection closed unreachable {reason: null, message: null, retry_delay: null, retry_count: null, will_retry: false}
main.js:43 Connection closed.
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] connection accepted from peer tcp4:[ip_address]:7110
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] Connection made to tcp4:[ip_address]:7110
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] dropping connection to peer tcp4:[ip_address]:7110 with abort=True: WebSocket opening handshake timeout (peer did not finish the opening handshake in time)
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] Connection to/from tcp4:[ip_address]:7110 was aborted locally
[Router      32589 crossbar.router.protocol.WampWebSocketServerProtocol] _connectionLost: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally using ITCPTransport.abortConnection.
autobahn.min.js:90 using WAMP transport type: websocket
autobahn.min.js:181 WebSocket connection to 'ws://[domain]:8081/' failed: Error in connection establishment: net::ERR_CONNECTION_RESET
autobahn.min.js:87 connection closed unreachable {reason: null, message: null, retry_delay: null, retry_count: null, will_retry: false}
main.js:43 Connection closed.
最初,我在Crossbar配置中没有CA证书(错误中没有更改)。我想我应该添加它们,因为这可能与此有关,所以我从中获得了它们(不确定这是否正确)。我也试过了,但这件事让我不知所措(我到底需要什么?)

我不确定是什么原因导致了这些问题,无论是现在还是我遗漏了什么。这些机器充其量是跛脚的

请帮忙