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

Better dynamic WebSocket URL (for reverse proxy) #7

Open
VigibotDev opened this issue Mar 8, 2018 · 0 comments
Open

Better dynamic WebSocket URL (for reverse proxy) #7

VigibotDev opened this issue Mar 8, 2018 · 0 comments

Comments

@VigibotDev
Copy link

I use reverse proxy to put the stream inside the main HTTP/HTTPS port of my webserver, here is my working code at beginning of client.js :

I think you can remove my "CUSTOM" const and put this trick inside your code for better compatibility.

const CUSTOM = "ReverseProxy";

var port = window.location.port;
if (window.location.protocol == 'https:') {
        var protocol = 'wss:'
        if (!port) port = '443'
} else {
        var protocol = 'ws:'
        if (!port) port = '80'
}
 
startStream('video', 'videostats', protocol+'//'+window.location.hostname+':'+port+'/'+CUSTOM, true, 'auto', 2000)
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

1 participant