to create a WorldQL client use WorldQL.createNew
which takes 3 arguments
URL
- url to the WorldQL rest proxy ex: 'http://furry-act.auto.playit.gg:41075'
listenTimer
- a number for how long between pinging the server, cannot be less then 1 and not greater then 20 (the time limit the server times out) default: 1
listenGetLimit
- the maximum ammount of messages that can be gotten at once Defaut: 5
after that you get a client
.on(event: string,callback)
- connects a function to a event
.once(event: string,callback)
- connects a function to a event that will only be fired once
.connect()
- connects to the WorldQL Proxy so you can actually use the api fires ready
once connected
.disconenct()
- disconnects from the api fires event disconnect
.sendRawMessage(Message: MessageT)
- sends a message json to WorldQL
inputs:
Message
- a fully build MessageT
.sendGlobalMessage(worldName:string, replication:number|nil, payload:MessagePayload)
inputs:
worldName
- the world the message is sent in
replication
- a value from DataTypes.Enum.Replication
default: 0
payload
- the MessagePayload
.sendLocalMessage(worldName:string,position:Vec3T, replication:number|nil, payload:MessagePayload)
inputs:
worldName
- the world the message is sent in
position
- A Vec3T location, can be converted from vector3 using DataTypes.Converters.Vector3toVec3(V3:Vector3)
replication
- a value from DataTypes.Enum.Replication
default: 0
payload
- the MessagePayload
.sendRecordCreate(worldName:string, records: { [number] : DataTypes.RecordT })
inputs:
worldName
- the world the message is sent in
records
- A list/Array of RecordT values
.sendRecordDelete(worldName:string, records: { [number] : DataTypes.RecordT })
inputs:
worldName
- the world the message is sent in
records
- A list/Array of RecordT values
.sendRecordRead(worldName:string, records: { [number] : DataTypes.RecordT })
inputs:
worldName
- the world the message is sent in
records
- A list/Array of RecordT values
.sendAreaSubscribe(worldName:string,position:Vec3T)
inputs:
worldName
- the world the message is sent in
position
- A Vec3T location
.sendAreaUnsubscribe(worldName:string,position:Vec3T)
inputs:
worldName
- the world the message is sent in
position
- A Vec3T location
if you dont know what a ceartain message type does read about it here
NOTE: inorder to recieve GlobalMessage
s in a world you have to be subscribes to some point in the world
ready
() - fired once the Client has successfully connected to the Server
disconnect
() - fired when the client disconnnects from the server
peerConnect
(MessageT) - fired whenever another client joins
peerDisconnect
(MessageT) - fired whenever another client leaves
globalMessage
(MessageT) - fired when a globalMessage is recieved
localMessage
(MessageT) - fired when a localMessage is recieved
rawMessage
(MessageT) - fired when any message is recieved
recordReply
(MessageT) - fired as a response to Record operations