-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { EventEmitter } from '@discord-player/utils'; | ||
import type { PlayerNode } from '../PlayerNode'; | ||
|
||
export interface ConnectorEvents { | ||
ready: () => Awaited<unknown>; | ||
close: () => Awaited<unknown>; | ||
error: (error: Error) => Awaited<unknown>; | ||
} | ||
|
||
export abstract class Connector extends EventEmitter<ConnectorEvents> { | ||
/** | ||
* Creates a new connector. | ||
* @param node - The player node instance | ||
*/ | ||
public constructor(public readonly node: PlayerNode) { | ||
super(); | ||
} | ||
|
||
/** | ||
* Connects to the node. | ||
*/ | ||
public abstract connect(): Promise<void>; | ||
/** | ||
* Disconnects from the node. | ||
*/ | ||
public abstract disconnect(): Promise<void>; | ||
/** | ||
* Whether the node is connected. | ||
*/ | ||
public abstract isConnected(): boolean; | ||
/** | ||
* Send a packet to the node. | ||
* @param data - The data to send | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
public abstract send(data: any): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Connector } from './Connector'; | ||
|
||
export class IPC extends Connector { | ||
public connect(): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
public disconnect(): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
public isConnected(): boolean { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
public send(): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Connector } from './Connector'; | ||
|
||
export class TCP extends Connector { | ||
public connect(): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
public disconnect(): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
public isConnected(): boolean { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
public send(): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |