echoing-glass-72062
04/16/2026, 6:46 PMtall-airline-16756
04/16/2026, 6:46 PMtall-airline-16756
04/16/2026, 6:47 PMechoing-glass-72062
04/16/2026, 6:55 PMtall-airline-16756
04/16/2026, 6:56 PMpayload := []byte("hello user-123")
err := localParticipant.PublishDataPacket(
payload,
WithDataPublishDestination([]string{"user-123"}),
WithDataPublishReliable(true),
WithDataPublishTopic("private-message"),
)
if err != nil { /* handle error */ }
2) RPC (request → response) to a specific identity
res, err := localParticipant.PerformRpc(PerformRpcParams{
DestinationIdentity: "user-123",
Method: "privateMessage",
Payload: "ping",
ResponseTimeout: &timeout, // e.g., time.Duration(5)*time.Second
})
if err != nil {
// check error type: RpcRecipientDisconnected, RpcResponseTimeout, RpcRequestPayloadTooLarge, etc.
}
if res != nil { fmt.Println("response:", *res) }
Important details
• RPC payload limit is 15,360 bytes; large data must be chunked or sent via a separate transfer channel.
• Use topics to route/identify message types on the client.
• For reliability: choose reliable for chat/commands, lossy for high-frequency telemetry.
• Always handle RPC errors (recipient disconnected, timeouts, app errors) and check publish errors for unreachable targets.
If you want, tell me:
• Do you need one-way messages, request/response, or file transfer?
• Any constraints (payload sizes, throughput, guaranteed delivery)?
I’ll provide a tailored code template and error-handling patterns for your bridge.
Sources: examples/rpc/main.go, with interactive elements