javascript - socket.io 404 cant connect with socket.io server -


i have webrtc / socket.io / nodejs running on server, works fine when go https://domain.com:8080 test video conference.

but want script run in webserver /public_html/

but dont know why not connecting 8080 server. "socket.io.js https://domain.com/socket.io/?eio=3&transport=polling&t=lpgzs2k 404 (not found)"

my server (server.js)

// load required modules var https    = require("https");              // http server core module var express = require("express");           // web framework external module var servestatic = require('serve-static');  // serve static files var socketio = require("socket.io");        // web socket external module var easyrtc = require("../");    const fs = require('fs');            // easyrtc external module  const options = {   key: fs.readfilesync('key.pem'),   cert: fs.readfilesync('cert.pem') };  // set process name process.title = "node-easyrtc";  // setup , configure express http server. expect subfolder called "static" web root. var app = express(); app.use(servestatic('static', {'index': ['index.html']}));  // start express http server on port 8080 var webserver = https.createserver(options, app).listen(8080);  // start socket.io attaches express server var socketserver = socketio.listen(webserver, {"log level":1});  easyrtc.setoption("loglevel", "debug");  // overriding default easyrtcauth listener, can directly access callback easyrtc.events.on("easyrtcauth", function(socket, easyrtcid, msg, socketcallback, callback) {     easyrtc.events.defaultlisteners.easyrtcauth(socket, easyrtcid, msg, socketcallback, function(err, connectionobj){         if (err || !msg.msgdata || !msg.msgdata.credential || !connectionobj) {             callback(err, connectionobj);             return;         }          connectionobj.setfield("credential", msg.msgdata.credential, {"isshared":false});          console.log("["+easyrtcid+"] credential saved!", connectionobj.getfieldvaluesync("credential"));          callback(err, connectionobj);     }); });  // test, lets print credential console every room join! easyrtc.events.on("roomjoin", function(connectionobj, roomname, roomparameter, callback) {     console.log("["+connectionobj.geteasyrtcid()+"] credential retrieved!", connectionobj.getfieldvaluesync("credential"));     easyrtc.events.defaultlisteners.roomjoin(connectionobj, roomname, roomparameter, callback); });  // start easyrtc server var rtc = easyrtc.listen(app, socketserver, null, function(err, rtcref) {     console.log("initiated");      rtcref.events.on("roomcreate", function(appobj, creatorconnectionobj, roomname, roomoptions, callback) {         console.log("roomcreate fired! trying create: " + roomname);          appobj.events.defaultlisteners.roomcreate(appobj, creatorconnectionobj, roomname, roomoptions, callback);     }); });  //listen on port 8080 webserver.listen(8080, function () {     console.log('listening on http://localhost:8080'); }); 

my html file on de web server. structure https://domain.com/test.html

<!doctype html> <html>   <head>     <title>easyrtc demo:easyrtc demo: video+audio hd 720</title>     <link rel="stylesheet" type="text/css" href="/easyrtc/easyrtc.css" />     <script src="js/socket.io.js"></script>     <script type="text/javascript" src="js/easyrtc.js"></script>     <script type="text/javascript" src="js/video.js"></script>  <script> var selfeasyrtcid = "";   function connect() {   easyrtc.setvideodims(1280,720);   easyrtc.enabledebug(false);   easyrtc.setroomoccupantlistener(convertlisttobuttons);   easyrtc.easyapp("easyrtc.videochathd", "selfvideo", ["callervideo"], loginsuccess, loginfailure); }   function clearconnectlist() {   var otherclientdiv = document.getelementbyid("otherclients");   while (otherclientdiv.haschildnodes()) {     otherclientdiv.removechild(otherclientdiv.lastchild);   } }   function convertlisttobuttons (roomname, data, isprimary) {   clearconnectlist();   var otherclientdiv = document.getelementbyid("otherclients");   for(var easyrtcid in data) {     var button = document.createelement("button");     button.onclick = function(easyrtcid) {       return function() {         performcall(easyrtcid);       };     }(easyrtcid);      var label = document.createtextnode(easyrtc.idtoname(easyrtcid));     button.appendchild(label);     button.classname = "callbutton";     otherclientdiv.appendchild(button);   } }   function performcall(othereasyrtcid) {   easyrtc.hangupall();   var acceptedcb = function(accepted, caller) {     if( !accepted ) {       easyrtc.showerror("call-rejected", "sorry, call " + easyrtc.idtoname(caller) + " rejected");     }   };   var successcb = function() {};   var failurecb = function() {};   easyrtc.call(othereasyrtcid, successcb, failurecb, acceptedcb); }   function loginsuccess(easyrtcid) {   selfeasyrtcid = easyrtcid;   document.getelementbyid("iam").innerhtml = "i " + easyrtc.cleanid(easyrtcid); }   function loginfailure(errorcode, message) {   easyrtc.showerror(errorcode, message); }   // sets calls automatically accepted (this default behaviour) easyrtc.setacceptchecker(function(caller, cb) {   cb(true); } );  </script>   </head>    <body  onload="connect();">         <h1>easyrtc demo: video+audio hd 720p</h1>         <div id="democontainer">           <div>           note: own image show postage stamp sized, while other party"s video shown in high-definition (1280x720). note: not webcams seen webrtc providing high-definition video; fallback use standard definition (640x480).           </div>            <div id="connectcontrols">             <div id="iam">not yet connected...</div>             <br />             <strong>connected users:</strong>             <div id="otherclients"></div>           </div>           <div id="videos">              <div style="position:relative;float:left;" width="1282" height="722">               <video autoplay="autoplay" id="callervideo"></video>               <video  class="easyrtcmirror" autoplay="autoplay" id="selfvideo" muted="true" volume="0" ></video>             </div>             <!-- each caller video needs in it"s own div it"s close button can positioned correctly -->           </div>         </div>   </body> </html> 

socket.io.js: http://81.171.38.245/js/socket.io.js

getting expert in, seems little bit difficult me


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -