Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleWebRTC Using My Signaling Server Does Not Initiate Client/Server Hello Messages #710

Closed
vinodmap opened this issue May 28, 2018 · 3 comments

Comments

@vinodmap
Copy link

vinodmap commented May 28, 2018

I am trying to get my SimpleWebRTC to use the SignalMaster signaling server that I have setup. The signaling server I have setup is running. At https://github.com/andyet/signalmaster, I successfully completed steps 1-4; then generated the ssl certs, I setup production.json, and am successfully running in production mode. I get {"code":0,"message":"Transport unknown"} when I go to my signalmaster URL https://54.xxx.xx.xxx:8888/socket.io/ (I kept it at 8888, and did not change to 443 because it gave me an error saying it could not listen on 443). I assume this is okay. Now, I call SimpleWebRTC() and specify the url: "https://54.xxx.xx.xxx:8888/" parameter for the signaling server. Video does not come up. I wiresharked it, and here is a snippet of the results:

wireshark_snippet-using_my_signaling_server

I then ran it using the SimpleWebRTC sandbox (where the video does come up), here is a snippet:
wireshark_snippet-using_sandbox

Looking at the snippet with my signaling server running, from the beginning and then for 60-80 seconds later (until I stopped the Wireshark), it just constantly sending/receiving [ACK] and [PSH, ACK] over and over again (to/from 54.xxx.xxx.xxx). But if you look at the snippet of the connection to the sandbox server, within approx 1 second of the attempted connection, my computer sends a "Client Hello" to the sandbox signaling server (Msg# 12 in the snippet) and then the server sends a response "Server Hello" in Msg# 14. In the snippet with my signaling server, my machine never sends a Client Hello. How can I debug why this is?

Here is my production.json:

{
  "isDev": true,
  "server": {
    "port": 8888,
    "secure": true,
    "key": "config/sslcerts/key.pem",
    "cert": "config/sslcerts/cert.pem",
    "password": "xxxxxxx"

  },
  "rooms": {
    "/* maxClients */": "/* maximum number of clients per room. 0 = no limit */",
    "maxClients": 0
  },
  "stunservers": [
    {
      "urls": "stun:ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com:3478"
    }
  ],

  "turnservers": [
    {
      "urls": ["turn:ec2-xx-xxx-xxx-xx.us-west-2.compute.amazonaws.com:3478"],
      "username": "xxx",
      "password": "xxx",
      "expiry": 86400
    }
  ]

}

Also, per @fippo's comment in #85,

I modified signalmaster's sockets.js to have this line:

credentials.push({
username: config.turnservers.username,
credential: config.turnservers.password,
urls: config.turnservers.urls
});
client.emit('turnservers', credentials);

The username/credential match what I'm putting int he call to SimpleWebRTC() and on my turn/stun server. Note, my stun/turn servers have worked for more than a year, so I know that's not the problem. Is there a change to the SimpleWebRTC call or in SignalMaster that the problem lies? How can I debug this SignalMaster issue, e.g., log files or anything else in the configuration? Thank you.

```~
@fippo
Copy link
Contributor

fippo commented May 30, 2018

Now, I call SimpleWebRTC() and specify the url: "http://54.xxx.xx.xxx:8888/" parameter for the signaling server

Unless you also use http to serve your app this will not work and should show a mixed content warning in the chrome console.

@vinodmap
Copy link
Author

I'm sorry, this was a mistake in my post, not in the actual code how I was specifying it. My post should have said:

Now, I call SimpleWebRTC() and specify the url: "https://54.xxx.xx.xxx:8888/" parameter for the signaling server

I have since corrected the post. I was indeed specifying https and not http in the new SimpleWebRTC() call. So the specifying of https vs http is not the problem. Would I still have the same problem if I am specifying https with port 8888 as opposed to port 443 ? As I mentioned above, when I specify port 443 in my production.json in my signalmaster server, when I run the server, it throws an error when I run server.js that says it cannot listen on port 443 at line 29 of server.js. If I need to run signalmaster on port 443, how can I get around that error (I know that you run the simplewebrtc sandbox signalmaster at port 443, so how do you get around that error?)? If I am able to run signalmaster on port 8888 with https, how else can I debug this problem? I am still not able to resolve this issue, and with your help, hope to do so. Thank you very much for your time.

@vinodmap
Copy link
Author

vinodmap commented Jun 13, 2018

I have resolved this issue. I believe the fix for the port 443 issue was trivial and I fixed it by using sudo when running the server. Separately, and more importantly relating to this post about the initiation of Client/Server Hello messages. The real problem was, I was not using Express to run the server, and was just trying to do "node server.js" (or "sudo node server.js") which by itself does not get the job done. I had to run it with Express. See my other post #715. While it now makes complete sense, it was not immediately obvious to me the way the instructions were laid out. With these changes, I am getting Client/Server Hello messages and the video now connects using my signaling server.

In addition, in sockets.js, I had to modify what I had previously (and above) which was:

credentials.push({
username: config.turnservers.username,
credential: config.turnservers.password,
urls: config.turnservers.urls
});
client.emit('turnservers', credentials);

and I changed it to:

credentials.push({        
username: config.turnservers[0].username,
credential: config.turnservers[0].password,
urls: config.turnservers[0].urls[0]
});
client.emit('turnservers', credentials);

Hope this helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants