Skip to content

Commit

Permalink
fix identifier + up version
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Mar 20, 2020
1 parent f0da923 commit 9d26468
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ActionCableSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|
s.name = 'ActionCableSwift'
s.module_name = 'ActionCableSwift'
s.version = '0.1.5'
s.version = '0.2.0'
s.summary = '🏰 Action Cable Swift is a client library being released for Action Cable Rails 5 which makes it easy to add real-time features to your app.'

s.swift_version = '5.1'
Expand Down
10 changes: 5 additions & 5 deletions Sources/ActionCableSwift/ACChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ public class ACChannel {
}
}

private func send(actionName: String, params: [String: Any] = [:], _ completion: (() -> Void)? = nil) {
private func send(actionName: String, data: [String: Any] = [:], _ completion: (() -> Void)? = nil) {
channelSerialQueue.async { [weak self] in
guard let self = self else { return }
do {
let data: Data = try ACSerializer.requestFrom(command: .message,
channelName: self.channelName,
action: actionName,
data: params)
identifier: self.identifier,
data: data)
self.client?.send(data: data) { completion?() }
} catch {
fatalError(error.localizedDescription)
Expand All @@ -107,10 +107,10 @@ public class ACChannel {

private func setupAutoSubscribe() {
if options.autoSubscribe {
if client?.isConnected ?? false { try? subscribe(params: subscriptionParams) }
if client?.isConnected ?? false { try? subscribe() }
client?.addOnConnected { [weak self] (headers) in
guard let self = self else { return }
try? self.subscribe(params: self.subscriptionParams)
try? self.subscribe()
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/ActionCableSwift/ACSerializer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ACSerializer {
public class func requestFrom(command: ACCommand,
action: String? = nil,
identifier: [String: Any],
data: [String: Any]
data: [String: Any] = [:]
) throws -> String {
try makeRequestDictionary(command: command,
action: action,
Expand All @@ -25,7 +25,7 @@ public class ACSerializer {
public class func requestFrom(command: ACCommand,
action: String? = nil,
identifier: [String: Any],
data: [String: Any]
data: [String: Any] = [:]
) throws -> Data {
try makeRequestDictionary(command: command,
action: action,
Expand Down
4 changes: 2 additions & 2 deletions Sources/ActionCableSwift/ActionCableSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public final class ACClient {
}

@discardableResult
public func makeChannel(name: String, subscriptionParams: [String: Any] = [:], options: ACChannelOptions? = nil) -> ACChannel {
channels[name] = ACChannel(channelName: name, client: self, subscriptionParams: subscriptionParams, options: options)
public func makeChannel(name: String, identifier: [String: Any] = [:], options: ACChannelOptions? = nil) -> ACChannel {
channels[name] = ACChannel(channelName: name, client: self, identifier: identifier, options: options)
return channels[name]!
}

Expand Down

0 comments on commit 9d26468

Please sign in to comment.