voicechat. incomingpacket: Connect Asynchronous
Subscribe to inbound culling messages and decrypted WebRTC RTP packets. The callback runs on a deferred Luau task.
Luau
voicechat.incomingpacket:Connect(callback: (VoicePacket) -> ()) -> VoicePacketConnectionParameters
Call this method with a voicechat.incomingpacket 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.Data is an owned buffer snapshot. Use :Disconnect() when finished. The observer does not change or block the packet.
Example
Luau
local connection = voicechat.incomingpacket:Connect(function(packet)
print(packet.Channel, buffer.len(packet.Data))
end)
-- connection:Disconnect()