Options
All
  • Public
  • Public/Protected
  • All
Menu

P3 socket type.

Hierarchy

  • P3Socket

Index

Constructors

constructor

  • new P3Socket(address: string, _server?: P3Server, _isServerClient?: boolean): any
  • Parameters

    • address: string
    • Optional _server: P3Server
    • Optional _isServerClient: boolean

    Returns any

Properties

_heartbeatInterval

_heartbeatInterval: number

Heartbeat interval.

_isServerClient

_isServerClient: boolean

Whether this socket is a server client.

_server

_server: P3Server

P3 server.

closed

closed: boolean

Whether the socket is closed.

connected

connected: boolean

Whether the socket is connected.

heartbeat

heartbeat: number

Heartbeat.

nonce

nonce: number

nonce

peerID

peerID: string

Peer ID.

remoteAddress

remoteAddress: string

The remote address

responsePort

responsePort: number

Response port.

Methods

connect

  • connect(): Promise<void>
  • Attempts a connection.

    Returns Promise<void>

disconnect

  • disconnect(sendDisconnectPacket?: boolean, reason?: { message: string }): Promise<void>
  • Disconnect.

    Parameters

    • Optional sendDisconnectPacket: boolean

      Whether to send a disconnect packet.

    • Optional reason: { message: string }

      The reason for disconnecting.

      • message: string

    Returns Promise<void>

send

  • send(dat: any): Promise<void>
  • Send some data.

    Parameters

    • dat: any

      The data to send.

    Returns Promise<void>

Generated using TypeDoc