rtsp-relay
                                
                                
                                
                                    rtsp-relay copied to clipboard
                            
                            
                            
                        SSL
I'd like to use your tsp-replay with SSL... I use let's encrypt certificate and I serve the html pages as HTTPS but the socket doesn't works.....
I tried to change WS in WSS but nothing happen ... Can you help me?
thanks
Hi, it should work immediately if you just change the URL to wss://. I've tested it and it works for me.
To debug this, you can
- open the developer tools
 - go to the "network" tab
 - filter only "ws" connections
 - see if the request is successful. The response should be HTTP 101.
 

If you can't find the issue there, compare the WSS request to the equivalent WS one and see if there are missing/different headers. and whether the messages get through at all.
Let me know if you still have issues
Hi,
I have changed the app on express in https....
var fs = require('fs'); var http = require('http'); var https = require('https'); var privateKey = fs.readFileSync('sslcert/server.key', 'utf8'); var certificate = fs.readFileSync('sslcert/server.crt', 'utf8');
var credentials = {key: privateKey, cert: certificate}; var express = require('express'); var app = express();
// your express configuration here
var httpServer = http.createServer(app); var httpsServer = https.createServer(credentials, app);
httpServer.listen(8080); httpsServer.listen(8443);
and now the sockets are in HTTPS....
but when I change ws....to was but the browser say that can not connect to insicure socket
Hi, I've just released v1.2.0 which I've tested with the following example:
const fs = require('fs');
const https = require('https');
const express = require('express');
const rtspRelay = require('.');
const key = fs.readFileSync('./server.key', 'utf8');
const cert = fs.readFileSync('./server.crt', 'utf8');
const app = express();
const httpsServer = https.createServer({ key, cert }, app);
const { proxy } = rtspRelay(app, httpsServer);
app.ws(
  '/api/stream',
  proxy({
    url: `rtsp://localhost:8554/sync-test-1`,
    verbose: true,
  }),
);
app.get('/', (req, res) =>
  res.send(`
  <canvas id='canvas'></canvas>
  <script src='https://cdn.jsdelivr.net/gh/phoboslab/jsmpeg@9cf21d3/jsmpeg.min.js'></script>
  <script>
    new JSMpeg.Player('wss://' + location.host + '/api/stream', {
      canvas: document.getElementById('canvas')
    })
  </script>
`),
);
httpsServer.listen(8443);
let me know if the latest version works for you
THANKS
this week I will try.... may be I done some mistakes.... I will try with your last version.
Also having the same problem...