Send device id to server

This commit is contained in:
Andras Schmelczer 2025-04-04 23:15:05 +01:00
parent 69438a78c6
commit a25027bc90
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
4 changed files with 27 additions and 3 deletions

View file

@ -31,7 +31,9 @@ export class Syncer {
| undefined;
private applyRemoteChangesWebSocket: WebSocket | undefined;
// eslint-disable-next-line @typescript-eslint/max-params
public constructor(
private readonly deviceId: string,
private readonly logger: Logger,
private readonly database: Database,
private readonly settings: Settings,
@ -291,7 +293,12 @@ export class Syncer {
// The JS WebSocket API doesn't support setting headers, so we have to send the token as a message
this.applyRemoteChangesWebSocket.onopen = (): void => {
this.logger.info("WebSocket connection opened");
this.applyRemoteChangesWebSocket?.send(settings.token);
this.applyRemoteChangesWebSocket?.send(
JSON.stringify({
deviceId: this.deviceId,
token: settings.token
})
);
this.webSocketStatusChangeListeners.forEach((listener) => {
listener();
});