Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

A lightweight client for a clientless application which will reply to any necessary packets in order to stay connected.

Hierarchy

Index

Constructors

constructor

Properties

Private _connected

_connected: boolean

Private _lastServer

_lastServer: Server

Private _time

_time: number

account

account: Account

Information about this client's account.

Private eventHandlers

eventHandlers: Map<string, function>

io

io: PacketIO

The packet interface for this client.

map

map: MapInfo

The map which the client is currently connected to, or undefined if the client is not connected.

objectId

objectId: number

The object id of this client when connected, and undefined if the client is not connected.

position

position: WorldPosData

The current position of this client when connected, and undefined if the client is not connected

proxy

proxy: Proxy

A proxy to route game traffic through.

stats

stats: PlayerData

The stat data of this client when it is connected, and undefined if the client is not connected.

Accessors

connected

  • get connected(): boolean
  • readonly

    Whether or not the socket is currently connected.

    Returns boolean

lastServer

time

  • get time(): number
  • readonly

    The time in milliseconds since this client was created.

    Returns number

Methods

attach

  • attach(socket: Socket): void
  • Attaches the client to the Socket.

    Parameters

    • socket: Socket

      The socket to attach to.

    Returns void

connect

  • Connects to the specified IP with the given state.

    Parameters

    Returns Promise<void>

detach

  • detach(): void

disconnect

  • disconnect(): Promise<void>

Private getConnection

  • getConnection(ip: string): Promise<Socket>

Private log

  • log(msg: string, level?: LogLevel): void
  • Parameters

    • msg: string
    • Default value level: LogLevel = LogLevel.Message

    Returns void

Private onClose

  • onClose(): void

Private onConnect

  • onConnect(): void

Private onError

  • onError(error: Error): void

Generated using TypeDoc