与服务器建立多个连接有什么意义?
What is the point to make more than one connection to a server?
The Server object is the main application container. The server
manages all incoming connections along with all the facilities
provided by the framework. A server can contain more than one
connection (e.g. listen to port 80 and 8080).
与服务器建立多个连接有什么意义?记忆?速度?安全吗?
最明显的用例是允许将 TLS 和非 TLS 请求路由到同一台服务器。您与同一台服务器建立了 2 个连接,一个有 TLS 配置,另一个没有。
var Hapi = require('hapi');
var server = new Hapi.Server();
// Receives TLS requests
server.connection({
port: 443,
tls: {
key: ...,
cert: ...
}
});
// Requests HTTP requests
server.connection({ port: 80 });
...
The Server object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080).
与服务器建立多个连接有什么意义?记忆?速度?安全吗?
最明显的用例是允许将 TLS 和非 TLS 请求路由到同一台服务器。您与同一台服务器建立了 2 个连接,一个有 TLS 配置,另一个没有。
var Hapi = require('hapi');
var server = new Hapi.Server();
// Receives TLS requests
server.connection({
port: 443,
tls: {
key: ...,
cert: ...
}
});
// Requests HTTP requests
server.connection({ port: 80 });
...