licode
licode copied to clipboard
wss protocol is not working
According to the official website documentation, configure licode and nginx to start and connect with your mobile phone.
I also tried to use docker configuration, but the result is the same, how can I solve this problem?
There is just configuration, please provide an extract of your erizoController configuration "hostname", "port", "secure". Also, and extract of your nginx conf. Probably is not configured well.
There is just configuration, please provide an extract of your erizoController configuration "hostname", "port", "secure". Also, and extract of your nginx conf. Probably is not configured well.
Below is my configuration file: licode_config.js.txt nginx.conf.txt
I tested through the online websocket tool: ws://my server address:8080/socket.io/?EIO=3&transport=websocket This returns as follows
if use wss://my server address:8080/socket.io/?EIO=3&transport=websocket tips not connect。
There are errors on those config files. The server name cannot contains spaces there. So for example there's a questions I'd like to know: Do you want all those services running under the same server name? Or you want to run the Erizo and Nuve separetely?
Well, suppose you want to run it under the same server name, call it "example.com". With this structure:
- example.com:443/ -> Licode's example (3001)
- example.com:443/nuve -> Licode's Nuve (3000) (if the app is the example, it probably won't be necesarry to set this up)
- example.com:443/socket.io -> Licode's Erizo (8080)
Ok, so let's start for the NGINX config:
- The 80 server is ok
- The 443 server is wrong configured, because WSS requires special considerations when you use NGINX
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name example.com;
<your certificate paths>
set $service <your internal hostname or IP, I think you use localhost>;
location / {
proxy_pass http://$service:3001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $http_host;
}
location /nuve {
proxy_pass http://$service:3000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $http_host;
}
location /socket.io {
proxy_pass http://$service:8080;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $http_host;
}
}
Note: Notice that I didn't use "/" after each location, that is because NGINX makes differences on it use, depending of what you really what to proxy pass. Be careful with that.
Ok, good, now you have the NGINX configured (I hope). So, the next thing you have to change, is the next few lines:
These lines, about the hostname, port and security, will be consumed by the Example APP or your app, so the interpretation you should give to them is "How do I consume the Erizo client on the browser? What kind of url should I use for that?", so, it is not an internal thing, is more than that, it is how Erizo expose for you to consume it. So replace:
- hostname: example.com
- port: 443
- secure: true
Because everything is behind NGINX and secure, so that is what you really need to use.
I hope it works for you, as it works for me.
Cheers, Sebastián.
P.D: The latest stable version that worked for me, was the v7. Yes, years ago. So if you can't deploy your project using the last version, well, I think there's some kind of issues around there that haven't been solved for now.
There are errors on those config files. The server name cannot contains spaces there. So for example there's a questions I'd like to know: Do you want all those services running under the same server name? Or you want to run the Erizo and Nuve separetely?
Well, suppose you want to run it under the same server name, call it "example.com". With this structure:
- example.com:443/ -> Licode's example (3001)
- example.com:443/nuve -> Licode's Nuve (3000) (if the app is the example, it probably won't be necesarry to set this up)
- example.com:443/socket.io -> Licode's Erizo (8080)
Ok, so let's start for the NGINX config:
- The 80 server is ok
- The 443 server is wrong configured, because WSS requires special considerations when you use NGINX
server { listen 443 ssl; listen [::]:443 ssl; server_name example.com; <your certificate paths> set $service <your internal hostname or IP, I think you use localhost>; location / { proxy_pass http://$service:3001; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Client-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Host $http_host; } location /nuve { proxy_pass http://$service:3000; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Client-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Host $http_host; } location /socket.io { proxy_pass http://$service:8080; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Client-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Host $http_host; } }
Note: Notice that I didn't use "/" after each location, that is because NGINX makes differences on it use, depending of what you really what to proxy pass. Be careful with that.
Ok, good, now you have the NGINX configured (I hope). So, the next thing you have to change, is the next few lines:
These lines, about the hostname, port and security, will be consumed by the Example APP or your app, so the interpretation you should give to them is "How do I consume the Erizo client on the browser? What kind of url should I use for that?", so, it is not an internal thing, is more than that, it is how Erizo expose for you to consume it. So replace:
- hostname: example.com
- port: 443
- secure: true
Because everything is behind NGINX and secure, so that is what you really need to use.
I hope it works for you, as it works for me.
Cheers, Sebastián.
P.D: The latest stable version that worked for me, was the v7. Yes, years ago. So if you can't deploy your project using the last version, well, I think there's some kind of issues around there that haven't been solved for now.
Thank you very much for your help. After configuring according to your way, open the browser and visit https://47.xx.92.xx/ At first, the image can be displayed, and it will be disconnected after a while,
I tried to use docker to rebuild the service. After shutting down the security of the Google browser's camera, I used the HTTP protocol to access and find that it was normal and the default index.html The video content can be seen on the page of. The traffic monitoring is about 40KB. However, if you click the test recording to enter, an error is reported as follows:
Whether using docker or nginx proxy is a problem. I don't know whether others have encountered it
I had some similar problems with that latest version. I think there are some bugs there. I used the docker image and also the compiled version and the same issue, including the NGINX without docker. Anyway, just have a look at the version 7, use that commit version if you want to use the docker one. I think that is the last version that I used and works fine. I tried it this weekend, so, as far as I know, it still in use.
P.S: I tested it inside a Docker Swarm too, so it is working perfectly. P.S2: Update the Erizo client to the version 7