File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,20 @@ public class RTCBandwidth: NSObject {
6464 }
6565 }
6666
67+ /// Connect to the signaling server to start publishing media.
68+ /// - Parameters:
69+ /// - url: Complete URL containing everything required to access WebRTC.
70+ /// - completion: The completion handler to call when the connect request is complete.
71+ /// - Throws: Throw when a connection to the signaling server experiences an error.
72+ public func connect( to url: URL , completion: @escaping ( ) -> Void ) throws {
73+ signaling = Signaling ( )
74+ signaling? . delegate = self
75+
76+ try signaling? . connect ( to: url) {
77+ completion ( )
78+ }
79+ }
80+
6781 /// Disconnect from Bandwidth's WebRTC signaling server and remove all local connections.
6882 public func disconnect( ) {
6983 signaling? . disconnect ( )
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ protocol SignalingDelegate {
2727
2828class Signaling {
2929 private let client = Client ( )
30-
30+
3131 var delegate : SignalingDelegate ?
3232
3333 func connect( using token: String , completion: @escaping ( ) -> Void ) throws {
@@ -44,6 +44,12 @@ class Signaling {
4444 throw SignalingError . invalidWebSocketURL
4545 }
4646
47+ try connect ( to: url) {
48+ completion ( )
49+ }
50+ }
51+
52+ func connect( to url: URL , completion: @escaping ( ) -> Void ) throws {
4753 try client. subscribe ( to: SignalingMethod . endpointRemoved. rawValue, type: EndpointRemovedParameters . self)
4854 client. on ( method: SignalingMethod . endpointRemoved. rawValue, type: EndpointRemovedParameters . self) { parameters in
4955 self . delegate? . signaling ( self , didReceiveEndpointRemoved: parameters)
You can’t perform that action at this time.
0 commit comments