import { WebSocketServerService } from "@autoplex/websocket-server";
import Application from "../Application";

export default class WebSocketServer extends WebSocketServerService<Application>
{
	/**
	 * The name of the service
	 */
	public NAME = "WebSocket Server";

	/**
	 * The application key used for authentication
	 */
	protected get appKey() {
		return Application.instance().APP_KEY;
	}

	/**
	 * Install the websocket methods
	 */
	protected override installMethods() {
		this.installMethod("test", this.test.bind(this));
	}

	protected test() {
		return new Promise<string>(resolve => {
			resolve("This is the response from the server");
		});
	}
}
