Skip to content

NetClient

Client connections between servers. It provides methods to connect to the server, disconnect, and send and receive messages.

Instance Properties

NetClient.onReceiveMessage : IClientReceive
Receive information.
NetClient.autoConnect : boolean
Whether to automatically connect to the server.
NetClient.serverIP : string
Server IP.
NetClient.serverPort : number
Server port.

Static Properties

NetClient.onReceiveMessage : IClientReceive
NetClient.isAutoConnect : boolean
(Read-only) Whether to automatically connect to the server.
NetClient.isConnected : boolean
(Read-only) Whether the server is being connected.

Static Methods

NetClient.Init ( ) : void
Initialize the client.
NetClient.Connect ( ) : void
NetClient.Disconnect ( ) : void
Disconnect from the server.
NetClient.CreateNewEntity ( string : prefab_id , NetEntity? : callback ) : void
Create a new entity for synchronizing information.
NetClient.InjectOnConnectEvent ( flag? : callback ) : void
What to do after successfully connecting to the server.
NetClient.InjectOnDisconnectEvent ( e : callback ) : void
What to do after disconnecting the server.
NetClient.Send ( message : string ) : void
Send a message to the server.
NetClient.Emit ( type : `` , args : ...params ) : T