Skip to content
This repository was archived by the owner on Jan 28, 2019. It is now read-only.

Commit 11919d0

Browse files
committed
Merge branch 'sbhc'
# Conflicts: # Sources/SKRTMAPI/Conformers/StarscreamRTM.swift
2 parents 2da959c + 43fe21f commit 11919d0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Sources/SKRTMAPI/SKRTMAPI.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public protocol RTMWebSocket {
3939
public protocol RTMAdapter: class {
4040
func initialSetup(json: [String: Any], instance: SKRTMAPI)
4141
func notificationForEvent(_ event: Event, type: EventType, instance: SKRTMAPI)
42+
func connectionClosed(with error: Error, instance: SKRTMAPI)
4243
}
4344

4445
public protocol RTMDelegate: class {
@@ -53,7 +54,7 @@ public final class SKRTMAPI: RTMDelegate {
5354
public var adapter: RTMAdapter?
5455
public var token = "xoxp-SLACK_AUTH_TOKEN"
5556
internal var options: RTMOptions
56-
var connected = false
57+
public private(set) var connected = false
5758

5859
var ping: Double?
5960
var pong: Double?
@@ -86,7 +87,7 @@ public final class SKRTMAPI: RTMDelegate {
8687
success: {(response) in
8788
self.connectWithResponse(response)
8889
}, failure: { (error) in
89-
print(error)
90+
self.adapter?.connectionClosed(with: error, instance: self)
9091
}
9192
)
9293
} else {
@@ -97,7 +98,7 @@ public final class SKRTMAPI: RTMDelegate {
9798
success: {(response) in
9899
self.connectWithResponse(response)
99100
}, failure: { (error) in
100-
print(error)
101+
self.adapter?.connectionClosed(with: error, instance: self)
101102
}
102103
)
103104
}
@@ -213,6 +214,8 @@ public final class SKRTMAPI: RTMDelegate {
213214
connected = false
214215
if options.reconnect {
215216
connect()
217+
} else {
218+
adapter?.connectionClosed(with: SlackError.rtmConnectionError, instance: self)
216219
}
217220
}
218221

0 commit comments

Comments
 (0)