1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-07-14 01:48:45 +00:00

Added version code sending.

This commit is contained in:
Koen 2023-12-07 16:56:20 +01:00
parent 18b61d549c
commit 33a8d684bf
9 changed files with 68 additions and 10 deletions

View file

@ -1,6 +1,6 @@
import net = require('net');
import { EventEmitter } from 'node:events';
import { PlaybackErrorMessage, PlaybackUpdateMessage, PlayMessage, SeekMessage, SetSpeedMessage, SetVolumeMessage, VolumeUpdateMessage } from './Packets';
import { PlaybackErrorMessage, PlaybackUpdateMessage, PlayMessage, SeekMessage, SetSpeedMessage, SetVolumeMessage, VersionMessage, VolumeUpdateMessage } from './Packets';
import { WebSocket } from 'ws';
enum SessionState {
@ -21,7 +21,8 @@ enum Opcode {
VolumeUpdate = 7,
SetVolume = 8,
PlaybackError = 9,
SetSpeed = 10
SetSpeed = 10,
Version = 11
};
const LENGTH_BYTES = 4;
@ -42,6 +43,10 @@ export class FCastSession {
this.state = SessionState.WaitingForLength;
}
sendVersion(value: VersionMessage) {
this.send(Opcode.Version, value);
}
sendPlaybackError(value: PlaybackErrorMessage) {
this.send(Opcode.PlaybackError, value);
}