Class: Network
Constructors
constructor
• new Network(options?): Network
Parameters
| Name | Type |
|---|---|
options | Partial<NetworkOptions> |
Returns
Properties
clientInfo
• clientInfo: Object
Type declaration
| Name | Type |
|---|---|
id | string |
metadata? | Record<string, any> |
username | string |
connected
• connected: boolean = false
disconnectReason
• disconnectReason: string = ""
intercepts
• intercepts: NetIntercept[] = []
joined
• joined: boolean = false
onConnect
• onConnect: () => void
Type declaration
▸ (): void
Returns
void
onDisconnect
• onDisconnect: () => void
Type declaration
▸ (): void
Returns
void
onJoin
• onJoin: (world: string) => void
Type declaration
▸ (world): void
Parameters
| Name | Type |
|---|---|
world | string |
Returns
void
onLeave
• onLeave: (world: string) => void
Type declaration
▸ (world): void
Parameters
| Name | Type |
|---|---|
world | string |
Returns
void
options
• options: NetworkOptions
socket
• socket: URL
url
• url: Url<{ [key: string]: any; }>
world
• world: string
ws
• ws: ProtocolWS
Accessors
concurrentWorkers
• get concurrentWorkers(): number
Returns
number
packetQueueLength
• get packetQueueLength(): number
Returns
number
rtcConnected
• get rtcConnected(): boolean
Returns
boolean
Methods
action
▸ action(type, data?): Promise<void>
Parameters
| Name | Type |
|---|---|
type | string |
data? | any |
Returns
Promise<void>
connect
▸ connect(serverURL, options?): Promise<Network>
Parameters
| Name | Type |
|---|---|
serverURL | string |
options | NetworkConnectionOptions |
Returns
Promise<Network>
connectWebRTC
▸ connectWebRTC(): Promise<void>
Returns
Promise<void>