1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-09-02 04:23:06 +00:00

Receivers: Module refractoring for portability

This commit is contained in:
Michael Hollister 2025-08-04 18:09:06 -05:00
parent 37514dc814
commit 1622a9b752
10 changed files with 54 additions and 61 deletions

View file

@ -2,6 +2,8 @@ import mdns from 'modules/@futo/mdns-js';
import { Logger, LoggerType } from 'common/Logger';
import { getAppName, getAppVersion, getComputerName } from 'src/Main';
import { PROTOCOL_VERSION } from 'common/Packets';
import { TcpListenerService } from './TcpListenerService';
import { WebSocketListenerService } from './WebSocketListenerService';
const logger = new Logger('DiscoveryService', LoggerType.BACKEND);
export class DiscoveryService {
@ -19,13 +21,15 @@ export class DiscoveryService {
// Note that txt field must be populated, otherwise certain mdns stacks have undefined behavior/issues
// when connecting to the receiver. Also mdns-js internally gets a lot of parsing errors when txt records
// are not defined.
this.serviceTcp = mdns.createAdvertisement(mdns.tcp('_fcast'), 46899, { name: name, txt: {
this.serviceTcp = mdns.createAdvertisement(mdns.tcp('_fcast'), TcpListenerService.PORT,
{ name: name, txt: {
version: PROTOCOL_VERSION,
appName: getAppName(),
appVersion: getAppVersion(),
} });
this.serviceTcp.start();
this.serviceWs = mdns.createAdvertisement(mdns.tcp('_fcast-ws'), 46898, { name: name, txt: {
this.serviceWs = mdns.createAdvertisement(mdns.tcp('_fcast-ws'), WebSocketListenerService.PORT,
{ name: name, txt: {
version: PROTOCOL_VERSION,
appName: getAppName(),
appVersion: getAppVersion(),