Skip to content

Commit 12a6a4d

Browse files
authored
Expose RPC types (#575)
1 parent cb91071 commit 12a6a4d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Sources/LiveKit/Core/RPC.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ import Foundation
2222
/// serialized and sent across the wire. The sender will receive an equivalent error on the other side.
2323
///
2424
/// Built-in types are included but developers may use any message string, with a max length of 256 bytes.
25-
struct RpcError: Error {
25+
public struct RpcError: Error {
2626
/// The error code of the RPC call. Error codes 1001-1999 are reserved for built-in errors.
2727
///
2828
/// See `RpcError.BuiltInError` for built-in error information.
29-
let code: Int
29+
public let code: Int
3030

3131
/// A message to include. Strings over 256 bytes will be truncated.
32-
let message: String
32+
public let message: String
3333

3434
/// An optional data payload. Must be smaller than 15KB in size, or else will be truncated.
35-
let data: String
35+
public let data: String
3636

37-
enum BuiltInError {
37+
public enum BuiltInError {
3838
case applicationError
3939
case connectionTimeout
4040
case responseTimeout
@@ -47,7 +47,7 @@ struct RpcError: Error {
4747
case unsupportedServer
4848
case unsupportedVersion
4949

50-
var code: Int {
50+
public var code: Int {
5151
switch self {
5252
case .applicationError: return 1500
5353
case .connectionTimeout: return 1501
@@ -63,7 +63,7 @@ struct RpcError: Error {
6363
}
6464
}
6565

66-
var message: String {
66+
public var message: String {
6767
switch self {
6868
case .applicationError: return "Application error in method handler"
6969
case .connectionTimeout: return "Connection timeout"
@@ -124,16 +124,16 @@ public typealias RpcHandler = (RpcInvocationData) async throws -> String
124124

125125
public struct RpcInvocationData {
126126
/// A unique identifier for this RPC request
127-
let requestId: String
127+
public let requestId: String
128128

129129
/// The identity of the RemoteParticipant who initiated the RPC call
130-
let callerIdentity: Participant.Identity
130+
public let callerIdentity: Participant.Identity
131131

132132
/// The data sent by the caller (as a string)
133-
let payload: String
133+
public let payload: String
134134

135135
/// The maximum time available to return a response
136-
let responseTimeout: TimeInterval
136+
public let responseTimeout: TimeInterval
137137
}
138138

139139
struct PendingRpcResponse {

0 commit comments

Comments
 (0)