mirror of
https://github.com/DerTyp7/teamspeak-obs-overlay.git
synced 2025-11-03 14:59:04 +01:00
[feature] add interfaces for classes
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { IAuthSenderPayload, IChannel, IClient, IConnection, ITS5Connection } from "interfaces/teamspeak";
|
||||
import { IAuthSenderPayload, IChannel, IClient, IConnection, ITS5ConnectionHandler, ITS5DataHandler, ITS5MessageHandler } from "interfaces/teamspeak";
|
||||
import { TS5DataHandler } from "./dataHandler";
|
||||
import { TS5MessageHandler } from "./messageHandler";
|
||||
|
||||
|
||||
// Establish connection to TS5 client
|
||||
// Main class
|
||||
export class TS5Connection implements ITS5Connection {
|
||||
export class TS5ConnectionHandler implements ITS5ConnectionHandler {
|
||||
ws: WebSocket; // Websocket connection to TS5 client
|
||||
authenticated = false; // Is the connection authenticated?
|
||||
remoteAppPort: number; // Port of TS5 client
|
||||
dataHandler: TS5DataHandler; // Handles data/lists and states
|
||||
messageHandler: TS5MessageHandler; // Handles messages received from TS5 client
|
||||
dataHandler: ITS5DataHandler; // Handles data/lists and states
|
||||
messageHandler: ITS5MessageHandler; // Handles messages received from TS5 client
|
||||
|
||||
constructor(
|
||||
// Port of TS5 client
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { IChannelInfos, IConnection, IChannel, IAuthMessage, IClientInfo, IClientMovedMessage, IClient, IClientPropertiesUpdatedMessage, ITalkStatusChangedMessage, IClientSelfPropertyUpdatedMessage, IServerPropertiesUpdatedMessage, IConnectStatusChangedMessage, IChannelsMessage, ITS5MessageHandler } from "interfaces/teamspeak";
|
||||
import { TS5DataHandler } from "./dataHandler";
|
||||
import { IChannelInfos, IConnection, IChannel, IAuthMessage, IClientInfo, IClientMovedMessage, IClient, IClientPropertiesUpdatedMessage, ITalkStatusChangedMessage, IClientSelfPropertyUpdatedMessage, IServerPropertiesUpdatedMessage, IConnectStatusChangedMessage, IChannelsMessage, ITS5MessageHandler, ITS5DataHandler } from "interfaces/teamspeak";
|
||||
|
||||
// Handle incoming messages from TS5 client
|
||||
export class TS5MessageHandler implements ITS5MessageHandler {
|
||||
ws: WebSocket;
|
||||
dataHandler: TS5DataHandler;
|
||||
dataHandler: ITS5DataHandler;
|
||||
|
||||
setActiveConnectionStateId: React.Dispatch<React.SetStateAction<number>>;
|
||||
activeConnectionId = 0;
|
||||
|
||||
constructor(ws: WebSocket, dataHandler: TS5DataHandler, setActiveConnectionStateId: React.Dispatch<React.SetStateAction<number>>) {
|
||||
constructor(ws: WebSocket, dataHandler: ITS5DataHandler, setActiveConnectionStateId: React.Dispatch<React.SetStateAction<number>>) {
|
||||
this.ws = ws;
|
||||
this.dataHandler = dataHandler;
|
||||
this.setActiveConnectionStateId = setActiveConnectionStateId;
|
||||
|
||||
Reference in New Issue
Block a user