Skip to content

Commit

Permalink
Merge branch 'master' of github.com:danielrhodes/Swift-ActionCableClient
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrhodes committed Nov 4, 2016
2 parents 99f4913 + 188dee3 commit 5e50c09
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@
[![Version](https://img.shields.io/cocoapods/v/ActionCableClient.svg?style=flat)](http://cocoapods.org/pods/ActionCableClient)
[![License](https://img.shields.io/cocoapods/l/ActionCableClient.svg?style=flat)](http://cocoapods.org/pods/ActionCableClient)
[![Platform](https://img.shields.io/cocoapods/p/ActionCableClient.svg?style=flat)](http://cocoapods.org/pods/ActionCableClient)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

[ActionCable](https://github.com/rails/rails/tree/master/actioncable) is a new WebSockets server being released with Rails 5 which makes it easy to add real-time features to your app. This Swift client makes it dead-simple to connect with that server, abstracting away everything except what you need to get going.

## Installation

ActionCableClient is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your `Podfile`:
To install, simply:

#### Cocoapods

Add the following line to your `Podfile` and run `pod install`

```ruby
pod "ActionCableClient"
```

### Swift 3
If you are looking for a Swift 3 Compatibile version, use the `Podfile` example below.
#### Carthage

Add the following to your `Cartfile` and run `carthage update` as normal.
```ruby
pod 'Starscream', :git => 'https://github.com/daltoniam/Starscream.git', :branch => 'swift3'
pod 'ActionCableClient', :git => 'https://github.com/danielrhodes/Swift-ActionCableClient', :branch => 'swift3'
github "danielrhodes/Swift-ActionCableClient"
```

Note: the API may have changed in some places.

## Usage

Expand All @@ -41,7 +43,7 @@ client.onConnected = {
print("Connected!")
}

client.onDisconnected = {(error: ErrorType?) in
client.onDisconnected = {(error: Error?) in
print("Disconnected!")
}
```
Expand All @@ -59,7 +61,7 @@ let roomChannel = client.create("RoomChannel") //The channel name must match the
```swift

// Receive a message from the server. Typically a Dictionary.
roomChannel.onReceive = { (JSON : AnyObject?, error : ErrorType?) in
roomChannel.onReceive = { (JSON : Any?, error : ErrorType?) in
print("Received", JSON, error)
}

Expand Down Expand Up @@ -123,8 +125,6 @@ For more documentation, see the [wiki](https://github.com/danielrhodes/Swift-Act

## Requirements

[SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON): Used internally to ensure we are getting good responses from the server.

[Starscream](https://github.com/daltoniam/Starscream): The underlying WebSocket library.

## Author
Expand Down

0 comments on commit 5e50c09

Please sign in to comment.