somed3v3loper Well-Known Member Licensed User Longtime User Dec 7, 2018 #1 Hi everybody , To save Erel and DonManfred some time , I decided to start a new thread I am using Erel's example from this thread https://www.b4x.com/android/forum/threads/mjpeg-cctv-server.73792/ I needed two things: 1- Limit connections so only one device (browser ) can view cam stream . 2- Make my connection secure for example by a password that should be typed correctly to view the stream . Thanks in advance
Hi everybody , To save Erel and DonManfred some time , I decided to start a new thread I am using Erel's example from this thread https://www.b4x.com/android/forum/threads/mjpeg-cctv-server.73792/ I needed two things: 1- Limit connections so only one device (browser ) can view cam stream . 2- Make my connection secure for example by a password that should be typed correctly to view the stream . Thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Dec 7, 2018 #2 somed3v3loper said: 1- Limit connections so only one device (browser ) can view cam stream . Click to expand... This one is more tricky than it might seem. Browsers can make multiple connections. You can close old connections when there is a new connection (Server_NewConnection) however you will probably encounter cases where the wrong connection is closed. 2. This line in Client.Astream_NewData reads the http request and makes sure that the client tries to connect to the root. Code: Copy 'filter out favicon calls If line.Trim <> "GET / HTTP/1.1" Then You can change it to: Code: Copy if line.Trim <> "GET /SecretPath HTTP/1.1" Then Now you will need to enter the following URL in order to connect: http://<ip>/SecretPath Upvote 0
somed3v3loper said: 1- Limit connections so only one device (browser ) can view cam stream . Click to expand... This one is more tricky than it might seem. Browsers can make multiple connections. You can close old connections when there is a new connection (Server_NewConnection) however you will probably encounter cases where the wrong connection is closed. 2. This line in Client.Astream_NewData reads the http request and makes sure that the client tries to connect to the root. Code: Copy 'filter out favicon calls If line.Trim <> "GET / HTTP/1.1" Then You can change it to: Code: Copy if line.Trim <> "GET /SecretPath HTTP/1.1" Then Now you will need to enter the following URL in order to connect: http://<ip>/SecretPath