Skip to content

Latest commit

 

History

History
294 lines (258 loc) · 6.66 KB

system.md

File metadata and controls

294 lines (258 loc) · 6.66 KB

System


Disconnect

Ask the server to terminate the connection.

  • Endpoint Type: Request -> Response
  • Source: User
  • Target: Server
  • Required Scopes: tachyon.lobby

Request

JSONSchema
{
    "title": "SystemDisconnectRequest",
    "tachyon": {
        "source": "user",
        "target": "server",
        "scopes": ["tachyon.lobby"]
    },
    "type": "object",
    "properties": {
        "type": { "const": "request" },
        "messageId": { "type": "string" },
        "commandId": { "const": "system/disconnect" },
        "data": {
            "title": "SystemDisconnectRequestData",
            "type": "object",
            "properties": { "reason": { "type": "string" } },
            "required": ["reason"]
        }
    },
    "required": ["type", "messageId", "commandId"]
}
Example
{
    "type": "request",
    "messageId": "amet aliqua Duis irure tempor",
    "commandId": "system/disconnect",
    "data": {
        "reason": "laborum consequat irure ullamco"
    }
}

TypeScript Definition

export interface SystemDisconnectRequest {
    type: "request";
    messageId: string;
    commandId: "system/disconnect";
    data?: SystemDisconnectRequestData;
}
export interface SystemDisconnectRequestData {
    reason: string;
}

Response

JSONSchema
{
    "title": "SystemDisconnectResponse",
    "tachyon": {
        "source": "server",
        "target": "user",
        "scopes": ["tachyon.lobby"]
    },
    "anyOf": [
        {
            "title": "SystemDisconnectOkResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "system/disconnect" },
                "status": { "const": "success" }
            },
            "required": ["type", "messageId", "commandId", "status"]
        },
        {
            "title": "SystemDisconnectFailResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "system/disconnect" },
                "status": { "const": "failed" },
                "reason": {
                    "enum": [
                        "internal_error",
                        "unauthorized",
                        "invalid_request",
                        "command_unimplemented"
                    ]
                },
                "details": { "type": "string" }
            },
            "required": ["type", "messageId", "commandId", "status", "reason"]
        }
    ]
}
Example
{
    "type": "response",
    "messageId": "et est veniam",
    "commandId": "system/disconnect",
    "status": "success"
}

TypeScript Definition

export interface SystemDisconnectOkResponse {
    type: "response";
    messageId: string;
    commandId: "system/disconnect";
    status: "success";
}

Possible Failed Reasons: internal_error, unauthorized, invalid_request, command_unimplemented


ServerStats

Get server stats such as user count.

  • Endpoint Type: Request -> Response
  • Source: User
  • Target: Server
  • Required Scopes: tachyon.lobby

Request

JSONSchema
{
    "title": "SystemServerStatsRequest",
    "tachyon": {
        "source": "user",
        "target": "server",
        "scopes": ["tachyon.lobby"]
    },
    "type": "object",
    "properties": {
        "type": { "const": "request" },
        "messageId": { "type": "string" },
        "commandId": { "const": "system/serverStats" }
    },
    "required": ["type", "messageId", "commandId"]
}
Example
{
    "type": "request",
    "messageId": "laborum incididunt mollit proident",
    "commandId": "system/serverStats"
}

TypeScript Definition

export interface SystemServerStatsRequest {
    type: "request";
    messageId: string;
    commandId: "system/serverStats";
}

Response

JSONSchema
{
    "title": "SystemServerStatsResponse",
    "tachyon": {
        "source": "server",
        "target": "user",
        "scopes": ["tachyon.lobby"]
    },
    "anyOf": [
        {
            "title": "SystemServerStatsOkResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "system/serverStats" },
                "status": { "const": "success" },
                "data": {
                    "title": "SystemServerStatsOkResponseData",
                    "type": "object",
                    "properties": { "userCount": { "type": "integer" } },
                    "required": ["userCount"]
                }
            },
            "required": ["type", "messageId", "commandId", "status", "data"]
        },
        {
            "title": "SystemServerStatsFailResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "system/serverStats" },
                "status": { "const": "failed" },
                "reason": {
                    "enum": [
                        "internal_error",
                        "unauthorized",
                        "invalid_request",
                        "command_unimplemented"
                    ]
                },
                "details": { "type": "string" }
            },
            "required": ["type", "messageId", "commandId", "status", "reason"]
        }
    ]
}
Example
{
    "type": "response",
    "messageId": "qui",
    "commandId": "system/serverStats",
    "status": "success",
    "data": {
        "userCount": 35222626
    }
}

TypeScript Definition

export interface SystemServerStatsOkResponse {
    type: "response";
    messageId: string;
    commandId: "system/serverStats";
    status: "success";
    data: SystemServerStatsOkResponseData;
}
export interface SystemServerStatsOkResponseData {
    userCount: number;
}

Possible Failed Reasons: internal_error, unauthorized, invalid_request, command_unimplemented