网页忽然504是什么原因造成的?网页提醒websocket连接错误?

发布时间:2023-07-04 15:16:20
编辑:
来源:cms科技
字体:

网页忽然504是什么原因造成的?

1、网络504一般是因为服务器关闭或出错导致。

2、当然也有可能是我们的光猫前端出现了问题。

3、解决方法也很简单,只需要联系相关服务人员即可。

4、如果只有某个网站504,那么联系这个网站的管理员让他解决。(一般大网站可以去他们的微博、论坛等寻找联系方式)

5、如果所有网站都这样,那么拨打你的网络运营商电话,让他们解决就行了。

网页提醒websocket连接错误?

这是我的服务器端代码。

var http = require('http');

var express = require('express');

var ExpresspeerServer = require('peer').ExpresspeerServer;

var app = express();

var server = http.createServer(app);

var options = {

debug: true,key: 'peerjs',allow_discovery: true,ssl: {

key: '',cert: ''

},proxied: true

};

var expresspeerServer = ExpresspeerServer(server,options);

app.use('/api',expresspeerServer);

app.use('/',express.static('.'));

app.use('/list',function (req,res) {

var port = process.env.PORT || 8080;

server.listen(port,function () {

console.log('Basic-ss live at',port);

expresspeerServer.on('connection',function (id) {

console.log('Peer connected with id:',id);

expresspeerServer.on('disconnect',function (id) {

console.log('Peer %s disconnected',id);

以下是连接对等方的客户端代码。

initPeer(peerId) {

this.peer = new Peer(peerId,{

host: 'localhost',port: 8080,path: '/api',debug: 3,config: {

'iceServers': [

{ url: 'stun:stun.l.google.com:19302' },]

setTimeout(() => {

this.currentPeerId = this.peer.id;

if (this.currentPeerId !== null) {

isPeerConnected = true;

} else {

isPeerConnected = false;

console.log('Current Peer ID',this.currentPeerId);

},4000);

此代码在localhost中可以正常运行。 这是我在服务器中上传的代码。

this.peer = new Peer(peerId,{

host: '',===> my domain name here.

port: 8080,key: 'mebstelemedclinic',{

url: 'turn:192.158.29.39:3478?transport=udp',credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',username: '28224511:1379330808'

如果使用相同的服务器代码和上面的客户端代码,则会出现连接错误。

WebSocket connection to 'wss://mydomain.in:8080/api/peerjs?key=peerjs&id=LY42201PH-yKy04f-ygqZJhqrBmezG6&token=n42tatqqn9e' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

标签: 网页出现504是什么原因造成的 网页忽

   原标题:网页忽然504是什么原因造成的?网页提醒websocket连接错误?

>更多相关文章
最近更新