Library globals

Class globals . mp_broadcast . BroadcastChannel

View source

Broadcast primitive using a MP enabled string property.
Broadcasts from users in multiplayer.ignore are ignored.

BroadcastChannel.new(mpp_path, process)
Create a new broadcast primitive. Any MP user with the same
primitive will receive all messages sent to the channel from the point
she/he joined (barring severe MP packet loss).
NOTE: Message delivery is not guaranteed.
mpp_path - MP property path                        : string
process  - handler called when receiving a message : func (n, msg)
n is the base node of the senders property tree
(i.e. /ai/models/multiplay[x])
send_to_self - if 1 locally sent messages are      : int {0,1}
delivered just like remote messages.
If 0 locally sent messages are not delivered
to the local receiver.
accept_predicate - function to select which        : func (p)
multiplayers to listen to.
p is the multiplayer entry node.
The default is to accept any multiplayer.
on_disconnect - function to be called when an      : func (p)
accepted MP user leaves.
enable_send   - Set to 0 to disable sending.

BroadcastChannel.send(msg)
Sends the message msg to the channel.
msg - text string with Binary data encoded data : string

BroadcastChannel.die()
Destroy this BroadcastChannel instance.