voicechat. outgoingpacket: Connect Asynchronous
Subscribe to outbound culling data and WebRTC RTP packet attempts. The callback receives an owned packet snapshot on a deferred Luau task.
Luau
voicechat.outgoingpacket:Connect(callback: (VoicePacket) -> ()) -> VoicePacketConnectionParameters
Call this method with a voicechat.outgoingpacket receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.
| Parameter | Type | Description |
|---|---|---|
callback | (VoicePacket) -> () | Function receiving a VoicePacket table. |
Argument fields
Luau
VoicePacket = {
Data: buffer, Channel: "data" | "rtp",
Direction: "outgoing" | "incoming",
Injected: boolean, Accepted: boolean
}Returns
VoicePacketConnectionA connection with Connected and Disconnect.
Luau
VoicePacketConnection = {Connected: boolean, Disconnect: Function}Usage notes
VoicePacket has Data (buffer), Channel ("data" or "rtp"), Direction, Injected, and Accepted fields.
Use :Disconnect() when finished. :Once(callback) observes one packet. The bounded observer queue may omit packets under heavy load.
Example
Luau
local connection = voicechat.outgoingpacket:Connect(function(packet)
print(packet.Channel, buffer.len(packet.Data), packet.Injected, packet.Accepted)
end)
-- connection:Disconnect()