Options
All
  • Public
  • Public/Protected
  • All
Menu

WebSocket abstraction. Handling all communication with the server.

Hierarchy

  • Socket

Index

Constructors

constructor

  • new Socket(url: string, gameHUD: any, webSocket?: any): Socket
  • Creates a new socket connection.

    Parameters

    • url: string

      Server address

    • gameHUD: any

      GameHUD instance

    • Optional webSocket: any

    Returns Socket

Properties

Private gameHUD

gameHUD: GameHUD

Game HUD instance because we need to show updates to the user on the HUD about the connection.

Private receiveQueue

receiveQueue: Queue<Packet>

Queue of all received packets from the server.

Private sendQueue

sendQueue: Queue<Packet>

Queue of all packets to be sent to the server.

Private socket

socket: WebSocket

Websocket object.

socketState

socketState: SocketState = ...

State of socket.

Methods

getReceived

  • Returns all Packets received from the server, waiting to be incorporated into game logic.

    Returns Packet[]

    Array of received packets.

Private readyCheck

  • readyCheck(): boolean

send

sendAll

  • sendAll(): void

Generated using TypeDoc