Files
HaishinKit.swift/RTCHaishinKit/Sources/RTC/RTCChannel.swift
2025-11-15 14:02:41 +09:00

18 lines
410 B
Swift

import Foundation
import HaishinKit
import libdatachannel
protocol RTCChannel {
var id: Int32 { get }
func send(_ message: Data) throws
}
extension RTCChannel {
public func send(_ message: Data) throws {
try RTCError.check(message.withUnsafeBytes { pointer in
return rtcSendMessage(id, pointer.bindMemory(to: CChar.self).baseAddress, Int32(message.count))
})
}
}