是否有任何 public HTTPS 上的 PeerServer?

Is there any public PeerServer over HTTPS?

我有一个使用 peerjs 的简单 Web 应用程序:https://github.com/chakradarraju/bingo。我打算用 github.io 来做一个演示,github.io 只会在 HTTPS 中提供服务,peerjs 库使用的默认 PeerServer 不支持 HTTPS。

有没有我可以使用的 public HTTPS PeerServer?

对此的简单回答是否定的。不幸的是,浏览器最近不允许除 localhost 之外的任何地址使用 http。

一种方法是设置一个 SSH 端口转发,这样您就可以欺骗浏览器,让它认为它正在与本地主机对话。好的演示,但不是生产。这是一些信息(来自 https://www.ssh.com/ssh/tunneling/example

In OpenSSH, remote port forwardings are specified using the -R option. For example:

ssh -R 8080:localhost:80 public.example.com

This allows anyone on the remote server to connect to TCP port 8080 on the remote server. The connection will then be tunneled back to the client host, and the client then makes a TCP connection to port 80 on localhost. Any other host name or IP address could be used instead of localhost to specify the host to connect to.

或者,如果您有自己的网络服务器,您可以使用 Let's encrypt: https://letsencrypt.org/ 使其成为 运行 https,而无需购买 SSL 证书。他们的工具非常好,五分钟就能在您的服务器上获得 https。

试试www

可以使用 letsencrypt 或自签名自动创建有效证书。

https://go-www.com/post/how-it-works/

Usage of ./www:
  -p port
        Listen on port (default 8000)
  -q quiet
        quiet mode
  -r root
        Document root path (default ".")
  -s your-domain.tld
        https://your-domain.tld if "localhost", port can be other than 443

此问题可以通过将 options.secure 设置为 true 来解决,如前所述 here