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

Commit

Permalink
Merge branch 'sbhc'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Sources/SKRTMAPI/Conformers/StarscreamRTM.swift
  • Loading branch information
pvzig committed Feb 8, 2018
2 parents 2da959c + 43fe21f commit 11919d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/SKRTMAPI/SKRTMAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public protocol RTMWebSocket {
public protocol RTMAdapter: class {
func initialSetup(json: [String: Any], instance: SKRTMAPI)
func notificationForEvent(_ event: Event, type: EventType, instance: SKRTMAPI)
func connectionClosed(with error: Error, instance: SKRTMAPI)
}

public protocol RTMDelegate: class {
Expand All @@ -53,7 +54,7 @@ public final class SKRTMAPI: RTMDelegate {
public var adapter: RTMAdapter?
public var token = "xoxp-SLACK_AUTH_TOKEN"
internal var options: RTMOptions
var connected = false
public private(set) var connected = false

var ping: Double?
var pong: Double?
Expand Down Expand Up @@ -86,7 +87,7 @@ public final class SKRTMAPI: RTMDelegate {
success: {(response) in
self.connectWithResponse(response)
}, failure: { (error) in
print(error)
self.adapter?.connectionClosed(with: error, instance: self)
}
)
} else {
Expand All @@ -97,7 +98,7 @@ public final class SKRTMAPI: RTMDelegate {
success: {(response) in
self.connectWithResponse(response)
}, failure: { (error) in
print(error)
self.adapter?.connectionClosed(with: error, instance: self)
}
)
}
Expand Down Expand Up @@ -213,6 +214,8 @@ public final class SKRTMAPI: RTMDelegate {
connected = false
if options.reconnect {
connect()
} else {
adapter?.connectionClosed(with: SlackError.rtmConnectionError, instance: self)
}
}

Expand Down

0 comments on commit 11919d0

Please sign in to comment.