简体   繁体   English

如何使 Azure 服务总线 Node.js 客户端通过 HTTPS(端口 443)而不是端口 5671 连接?

[英]How to make an Azure Service Bus Node.js client connect via HTTPS (port 443), not port 5671?

We are using the @azure/service-bus package to listen for Azure Service Bus messages in a Node.js application.我们正在使用@azure/service-bus package 在 Node.js 应用程序中侦听 Azure 服务总线消息。 Unfortunately the default port 5671 is blocked in our environment.不幸的是,默认端口 5671 在我们的环境中被阻止。

According to this documentation and this question the connectivity mode can be changed to HTTPS (port 443), at least from .NET (and maybe Java) like so:根据此文档此问题,连接模式可以更改为 HTTPS(端口 443),至少从 .NET(可能还有 Java)更改为:

ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Https;

How can we achieve the same in a Node.js based application?我们如何在基于 Node.js 的应用程序中实现相同的目标?

For https support, you will need to use WebSockets .对于https支持,您需要使用WebSockets Try to create your Service Bus client using the code below:尝试使用以下代码创建您的服务总线客户端:

const connectionString = 'your service bus connection string';
const connectionOptions = {
    webSocketOptions: {
        webSocket : WebSocket
    }
};
const serviceBusClient = new ServiceBusClient(connectionString, connectionOptions);

Now you'll be connecting to your Service Bus using https over port 443 instead of AMQP using port 5671.现在,您将使用https通过端口 443 而不是使用端口 5671 的AMQP连接到服务总线。

For more details, please see ServiceBusClientOptions and ServiceBusClient .有关更多详细信息,请参阅ServiceBusClientOptionsServiceBusClient

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Node.js + Express.js + Socket.io 端口 443(HTTPS TLS/SSL) - Node.js + Express.js + Socket.io on port 443 (HTTPS TLS/SSL) Node.js https 服务器:无法侦听端口 443 - 为什么? - Node.js https server: Can't listen to port 443 - Why? 443 Apache SSL端口和8888 https侦听端口不起作用-Node.js-socket.io - 443 apache SSL Port and 8888 https listening Port doesn't work - Node.js - socket.io 2个节点js + Express应用程序共享https端口443? - 2 node js + express applications sharing https port 443? 如何使用SAS密钥通过Node.js SDK连接到Azure Service Bus订阅? - How to connect to an Azure Service Bus subscription with the Node.js SDK using SAS Keys? Mac上的WebStorm node.js EACCES错误443运行端口 - WebStorm node.js EACCES error 443 running port on Mac 无法在端口80或443上运行node.js Web服务 - cannot run node.js webservice on port 80 or 443 Azure Service Bus Relay和node.js - Azure Service Bus Relay and node.js 如何在Node.js中异步接收Azure服务总线消息 - How to asynchronously receive a azure service bus message in node.js 当似乎没有其他应用程序正在尝试使用端口时,如何修复Node.js中的“ events.js:167错误错误:连接ECONNREFUSED 127.0.0.1:443”? - How to fix 'events.js :167 error Error: connect ECONNREFUSED 127.0.0.1:443' in Node.js when no other apps seems to be attempting to use the port?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM