clientBus

Methods
7
Fields
None

Getting one

clientBus

Methods

MethodReturnsDescription
subscribe(string, (string, number) -> ())()Call listener(data, senderTabId) for each message another tab publishes on this plugin's channel, on the client thread at the invoke po…
unsubscribe(string)()Stop listening on channel.
isHub()booleanWhether this tab is the hub.
isJoined()booleanWhether this tab has joined the bus (as the hub, or connected to it).
links()numberHow many tabs this one is linked to (the hub counts its members; a member, 1).
tabId()numberThis tab's id on the bus, as a listener's senderTabId names it.
publish(string, string)()Send data (a Luau string, any bytes) on this plugin's channel to every other client tab: each one's subscribe listener for the channe…

Method details

subscribe

subscribe: (ClientBus, string, (string, number) -> ()) -> ()

Call listener(data, senderTabId) for each message another tab publishes on this plugin's channel, on the client thread at the invoke point; replaces an earlier listener for it.

isJoined

isJoined: (ClientBus) -> boolean

Whether this tab has joined the bus (as the hub, or connected to it).

tabId

tabId: (ClientBus) -> number

This tab's id on the bus, as a listener's senderTabId names it.

publish

publish: (ClientBus, string, string) -> ()

Send data (a Luau string, any bytes) on this plugin's channel to every other client tab: each one's subscribe listener for the channel gets it at its next invoke point. A tab never hears its own messages; one not on the bus yet (it joins within a second of first use) drops the message. A client the launcher gave no bus key has the bus off, and this raises.