網頁忽然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連接錯誤?

>更多相關文章
最近更新