Latest 0.1.1
Homepage https://github.com/tenshilg/SwiftyActionCable
License MIT
Platforms ios 8.0, requires ARC
Dependencies SwiftyJSON, SwiftWebSocket
Authors

Version
License
Platform

Super simple implementation of Rails ActionCable client written in Swift.
Working on top of swift websocket library: https://github.com/tidwall/SwiftWebSocket

Example

// Initiate client with NSMutableURLRequest
let request = NSMutableURLRequest(URL: NSURL(string: "ws://localhost:3000/cable")!)
let client = ActionCableClient(mutableRequest: request)

// Create new channel
let exampleChannel = ActionChannel.init(name: "ExampleChannel")

// callback on message from server
exampleChannel.onMessage = { json in
  print(json)
  // send unsubscribe event to the server
  client.unsubscribeFrom(exampleChannel)
}

// callback on succesfull subsbscription
exampleChannel.onSubscribed  = {
    print("succesfully subscribed!")
}

// send subscribe to request to server and start listening
client.subscribeTo(exampleChannel)
exampleChannel.perform("say_hello")

Rails server example is here: https://github.com/tenshilg/ActionCableExample

Installation

SwiftyActionCable is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SwiftyActionCable"

Dependencies

Author

Roman Kovtunenko, [email protected]

License

SwiftyActionCable is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SwiftyActionCable",
    "version": "0.1.1",
    "summary": "Simple & Flexible Rails ActionCable client",
    "description": "Super simple implementation of Rails ActionCable client written in Swift. Working on top of swift websocket library: https://github.com/tidwall/SwiftWebSocket",
    "homepage": "https://github.com/tenshilg/SwiftyActionCable",
    "license": "MIT",
    "authors": {
        "Roman Kovtunenko": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tenshilg/SwiftyActionCable.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "dependencies": {
        "SwiftyJSON": [
            "~> 2.3.0"
        ],
        "SwiftWebSocket": [
            "~> 2.6.0"
        ]
    }
}

Pin It on Pinterest

Share This