mirror of
https://github.com/HaishinKit/HaishinKit.swift.git
synced 2026-05-07 20:12:28 +00:00
18 lines
410 B
Swift
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))
|
|
})
|
|
}
|
|
}
|