99import Starscream
1010import SwiftyJSON
1111
12- /// Used to connect to a channel's interactive controls through our Interactive protocol.
12+ /// Used to connect to a channel's interactive controls through our interactive protocol.
1313public class InteractiveClient : WebSocketDelegate {
1414
1515 // MARK: Properties
@@ -26,25 +26,25 @@ public class InteractiveClient: WebSocketDelegate {
2626 /// The id of the authenticated user in the app.
2727 private var userId : Int ?
2828
29- /// The current Interactive control state.
29+ /// The current interactive control state.
3030 private var state : String ?
3131
3232 /// The websocket through which control updates are received and sent.
3333 private var socket : WebSocket ?
3434
3535 /// Initializes an interactive connection, which needs to be stored by your own class.
36- public init ( delegate InteractiveDelegate : InteractiveClientDelegate ) {
37- delegate = InteractiveDelegate
36+ public init ( delegate interactiveDelegate : InteractiveClientDelegate ) {
37+ delegate = interactiveDelegate
3838 }
3939
4040 // MARK: Public Methods
4141
4242 /**
4343 Connects to an interactive channel given data that is received with InteractiveRoutes.getInteractiveDataByChannel
4444
45- :param: url The base URL of the Interactive server being connected to.
45+ :param: url The base URL of the interactive server being connected to.
4646 :param: channelId The id of the channel being connected to.
47- :param: key The key used to authenticate with Interactive .
47+ :param: key The key used to authenticate with interactive .
4848 :param: userId The id of the authenticated user in the app.
4949 */
5050 public func connect( url baseUrl: String , channelId: Int , key: String ? = nil , userId: Int ? = nil ) {
@@ -61,13 +61,13 @@ public class InteractiveClient: WebSocketDelegate {
6161 socket? . connect ( )
6262 }
6363
64- /// Disconnects from the Interactive server.
64+ /// Disconnects from the interactive server.
6565 public func disconnect( ) {
6666 self . socket? . disconnect ( )
6767 }
6868
6969 /**
70- Sends a packet to the Interactive server.
70+ Sends a packet to the interactive server.
7171
7272 :param: packet The packet being sent.
7373 */
@@ -86,14 +86,14 @@ public class InteractiveClient: WebSocketDelegate {
8686 private func updateState( state: String ) {
8787 if state != self . state {
8888 self . state = state
89- delegate? . InteractiveChangedState ( state)
89+ delegate? . interactiveChangedState ( state)
9090 }
9191 }
9292
9393 // MARK: WebSocketDelegate
9494
9595 public func websocketDidConnect( socket: WebSocket ) {
96- delegate? . InteractiveDidConnect ( )
96+ delegate? . interactiveDidConnect ( )
9797
9898 guard let authKey = authKey,
9999 userId = userId else {
@@ -108,13 +108,13 @@ public class InteractiveClient: WebSocketDelegate {
108108 }
109109
110110 public func websocketDidDisconnect( socket: WebSocket , error: NSError ? ) {
111- delegate? . InteractiveDidDisconnect ( )
111+ delegate? . interactiveDidDisconnect ( )
112112 }
113113
114114 public func websocketDidReceiveMessage( socket: WebSocket , text: String ) {
115115 if let ( packet, state) = InteractivePacket . receivePacket ( text) {
116116 if let packet = packet {
117- delegate? . InteractiveReceivedPacket ( packet)
117+ delegate? . interactiveReceivedPacket ( packet)
118118 }
119119
120120 if let state = state {
@@ -127,18 +127,18 @@ public class InteractiveClient: WebSocketDelegate {
127127 }
128128}
129129
130- /// The Interactive client's delegate, through which information is relayed to your app.
130+ /// The interactive client's delegate, through which information is relayed to your app.
131131public protocol InteractiveClientDelegate : class {
132132
133- /// Called when a connection is made to the Interactive server.
134- func InteractiveDidConnect ( )
133+ /// Called when a connection is made to the interactive server.
134+ func interactiveDidConnect ( )
135135
136136 /// Called when the client disconnects, whether on purpose or due to an error.
137- func InteractiveDidDisconnect ( )
137+ func interactiveDidDisconnect ( )
138138
139139 /// Called when the control state is changed by the broadcaster.
140- func InteractiveChangedState ( state: String )
140+ func interactiveChangedState ( state: String )
141141
142142 /// Called when a packet is received and interpreted.
143- func InteractiveReceivedPacket ( packet: InteractivePacket )
143+ func interactiveReceivedPacket ( packet: InteractivePacket )
144144}
0 commit comments