iceConnectionState is disconnected - VP9 Coded is null - PeerServer - javascript

I have an application which is using PeerJS for video streaming, and I'm using a node based Peer Server running on an Ubuntu Server instance, over HTTPS (SSL certificates installed on the server).
This is how I instanciate my PeerServer :
var server = PeerServer({
port:55127,
path:'/',
debug:true,
ssl:{
key: fs.readFileSync('/etc/apache2/ssl/mykey.key'),
cert: fs.readFileSync('/etc/apache2/ssl/mycert.crt')
}
});
This is how I create a peer connection :
var peer = new Peer('peerHost',{host: 'myhost.com', port: 55127, path: '/'})
Regarding ports, I have allowed 55127 both in UFW and in the router.
For some strange reason, my peer connections and video streaming are working perfectly in the LAN, but failing over the internet - although sometimes they work, for instance in occasions over a 3G mobile network.
While debugging the Peer connection, I stumbled upon these "errors":
PeerJS: VP9 Codec: null
PeerJS: iceConnectionState is disconnected, closing connections to (...)
No errors on the server side, all these are either on the host or on the client.
This issue is similar to this, this and this.
Does anyone have any idea of what could be wrong and how it could be fixed ?
Thanks in advance.

OK, seems that I was suffering from this issue, where a very common NAT/Firewall scenario, in any home-used router would block the ports that my PeerJS server needed to access, thus inhibiting the broker connection, and not allowing the video to be streamed.
The solution was to use an intermediate TURN server in order to override the NAT settings.
var peer = new Peer({host: 'host.com', port: 55127, path: '/', debug:true, config: {'iceServers': [{ url: 'stun:stun.l.google.com:19302' },{ url: 'turn:numb.viagenie.ca', username: 'username#gmail.com', credential: 'password' }]}});

Related

ERR_SSL_SSLV3_ALERT_CERTIFICATE_UNKNOWN thrown by wss server when client tries to connect to it

recently I've been trying to create a WebSocket server (using the ws library for node.js). At first I used the ws unencrypted protocol, but then I had to switch to wss. This brought some client authentication issues. When the client (running on a browser)
(client.js)
this.socket = new WebSocket(`wss://ipv4.address:port`);
... tries to connect to the Node.js-based server
(server.mjs:)
const server = createServer({
cert: readFileSync('/path/to/ssl_certificate.cer'),
key: readFileSync('/path/to/private_key.key'),
ca: [
readFileSync('/etc/ssl/certs/ca-certificates.crt'),
readFileSync('/path/to/ssl_certificate_INTERMEDIATE.cer')
],
rejectUnauthorized: false
});
const wss = new WebSocketServer({ server });
server.listen(port, "hostname", () => {
//the server actually listens, so this line of code is printed
console.log(`listening on wss://${wss.address().address}:${server.address().port}`);
});
server.on("tlsClientError", (err, tlsSocket) => {
console.error("TLS client error", err);
tlsSocket.destroy();
});
... it goes into "tlsClientError", printing this:
TLS client error [Error: C0D71E8ECB7F0000:error:0A000416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1584:SSL alert number 46
] {
library: 'SSL routines',
reason: 'sslv3 alert certificate unknown',
code: 'ERR_SSL_SSLV3_ALERT_CERTIFICATE_UNKNOWN'
}
This looks like the server isn't willing to accept the client's certificates. How do I set them? Is there something I'm not understanding about WebSockets over TLS?
I tried following the advice of many answers from StackOverflow, disabling rejectUnauthorized, but the node https server is still failing, even after adding the same SSL certificates my website is using (same hostname, different port)
EDIT:
I forgot to mention, that connecting from the same host as the server works (i.e. using the ws client part on the node side), as per https://github.com/websockets/ws/blob/master/examples/ssl.js, and even when disabling rejectUnauthorized (because I'm not using a self-signed certificate)

Peerjs Error: Could not get an ID from the server

using Peerjs cdn.It was working fine.Suddenly getting this error today Error: Could not get an ID from the server
peer = new Peer();
<script src="https://unpkg.com/peerjs#1.3.1/dist/peerjs.min.js"></script>
Even demo application given by peerjs documentation has this error now which was working fine before
https://jmcker.github.io/Peer-to-Peer-Cue-System/
Yes, the problem is known.
The public server is not available at the moment (cracked by botnet). The maintainer has already reported the cause of the issue on github: https://github.com/peers/peerjs/issues/937#issuecomment-1077781924
There is also a small guide on how to deploy your own server through Heroku.
Install peer and peerjs from npm.
configure the following on the client js file.
const peer = new Peer(undefined, {
host: 'localhost',
port: 5001,
path: '/'
});
Then while the initial server is running. open another terminal and run the following
peerjs --port 5001
voila, you have started peerServer and now you can obtain the peer.id.
There are some other ways to too. please refer to this link to explore those ways.

Connection to Redis cache failing

I have a node app connecting to a redis cache hosted on azure but whenever I'm trying to connect to it, the connection fails with an error message
I have enabled secure connection through a port and configured my node app accordingly
// This is my client module
const Redis = require("ioredis");
var client = new Redis(
{
port: 6380,
tls: true,
host: process.env.REDIS_HOST,
password: process.env.REDIS_PASSWORD,
family:
db: 0
}
);
module.exports = client;
This is the error I encounter whenever I start my app:
[ioredis] Unhandled error event: Error: unable to get local issuer certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1317:34)
at TLSSocket.emit (events.js:209:13)
at TLSSocket._finishInit (_tls_wrap.js:792:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:606:12)
The API ran for a while without any problems but then started throwing this error. My colleague is not having a problem running the same service and I'm assuming this is my machines certificates or lack of causing the issue. Any solutions or suggestions?
The problem was with the company wifi network I was using. The firewall did not allow me to connect to the cache.

How to configure AWS UBUNTU Server to access html via server IP address

So this post is not boring it is interesting, I am getting into AI cryptocurrency trading, there is only one open source platform that allows artificial intelligence to trade on my behalf, one method is run my own PC or use EC2 AWS.
For more History about GEKKO AI and server configuration go here:
https://gekko.wizb.it/docs/installation/configuring_gekko_on_a_server.html
Long story Short I have installed GEKKO AI on my EC2 Server, now the server is successfully running the AI but the User interface is not visible by browsing to the assigned server IP
Message From Putty Terminal says AI is successfully running on 3.85.36.175:3000
AI user interface address is 3.85.36.175:3000
Error Message on the browser: Site Refused to Connect
The following java script CODE should create a User interface on the following IP ADDRESS:
const CONFIG = {
headless: true,
api: {
host: '0.0.0.0',
port: 3000,
},
ui: {
ssl: false,
host: '3.85.36.175', // Set this to the IP of the machine that will run Gekko
port: 3000,
path: '/'
},
adapter: 'sqlite'
}
if(typeof window === 'undefined')
module.exports = CONFIG;
else
window.CONFIG = CONFIG;
In order to successfully view the AI user interface, I have to correctly configure the IP address.
The EC2 is running Ubuntu server, and I have installed Node js GIT and GEKKO to install the GEKKO AI.
Since this is an opensource project no one is available as to why the server IP address is not showing the USER INTERFACE
Exactly Same issue Broadly Discussed on HERE but no concrete solution:
https://github.com/askmike/gekko/issues/2195

Running Paho javascript example crashes network connection because of connect loop

I'm trying to connect to a local mosquitto mqqt broker via websockets and the paho javascript client. However, using the example shown at https://www.eclipse.org/paho/clients/js/ crashes my network connection. In the chrome or ie console I found the problem: The connection is made over and over again (function onConnect is called multiple times per second).
client.connect({onSuccess:onConnect});
// called when the client connects
function onConnect() {
// Once a connection has been made, make a subscription and send a message.
console.log("Connection was successful");
client.subscribe("World");
message = new Paho.MQTT.Message("Hello");
message.destinationName = "World";
client.send(message);
}
On the broker I can see the client connecting:
New client connected from 192.168.1.3 as web_78 (c1, k60, u'user123').
But the message does not get broadcasted by the client. When I terminate the browser, I see on the client:
Socket error on client web_78, disconnecting.
The same thing happens, when I try different Codeexample like this one: https://jpmens.net/2014/07/03/the-mosquitto-mqtt-broker-gets-websockets-support/
I'm using mosquitto version 1.5 on my Raspberry Pi and have really no Idea, how I can get this running. Maybe the problem is the mosquitto server and not the client?
This is the part of my mosquitto.conf where I define the ports
listener 9001
protocol websockets
Other clients can connect (e.g via paho python) and mqtt (without websockets).
pi#raspberrypi ~ $ sudo mosquitto -c /etc/mosquitto/mosquitto.conf
1530009485: mosquitto version 1.5 starting
1530009485: Config loaded from /etc/mosquitto/mosquitto.conf.
1530009485: Opening websockets listen socket on port 9001.
1530009485: Opening ipv4 listen socket on port 1883.
1530009485: Opening ipv6 listen socket on port 1883.
1530009485: New connection from 192.168.1.51 on port 1883.
1530009485: New client connected from 192.168.1.51 as DVES_9CE05F (c1, k15, u'johann').
Any help would be highly appreaciated!
EDIT Update:
The problem must be within my server, as I can access public broker like HiveMQ.
I had the same problem. There is a problem related to libwebsockets in Mosquitto 1.5.x, at least in the version that are installed on Raspberry Pi with Raspbian jessie. When I downgraded Mosquitto to 1.4.15 this problem was solved for me.
Read about it in, https://github.com/eclipse/mosquitto/issues/1050

Categories