add server version to log information

This commit is contained in:
Jakob Ketterl 2021-01-23 16:43:51 +01:00
parent 999d32fd8a
commit 1d9b2729ef

View File

@ -694,7 +694,17 @@ function on_ws_recv(evt) {
networkSpeedMeasurement.add(evt.data.length);
if (evt.data.substr(0, 16) === "CLIENT DE SERVER") {
divlog("Server acknowledged WebSocket connection.");
params = Object.fromEntries(
evt.data.slice(17).split(' ').map(function(param) {
var args = param.split('=');
return [args[0], args.slice(1).join('=')]
})
);
var versionInfo = 'Unknown server';
if (params.server && params.server === 'openwebrx' && params.version) {
versionInfo = 'OpenWebRX version: ' + params.version;
}
divlog('Server acknowledged WebSocket connection, ' + versionInfo);
} else {
try {
var json = JSON.parse(evt.data);