Skip to content

Repository files navigation

Phoenix

Carthage compatiblePlatform

Description

The Phoenix class provides a convenient mechanism to communicate with Phoenix Framework Channels.

Requirements

  • iOS 8.0+
  • Xcode 7.3+

Dependencies

Installation

Carthage

To integrate Phoenix into your project using Carthage, specify it in your Cartfile:

github "valery-bashkatov/Phoenix"

And then follow the instructions to install the framework and its dependencies.

Documentation

API Reference is located at http://valery-bashkatov.github.io/Phoenix.

Usage

import Phoenix
classRadioController:NSObject,PhoenixListener{varphoenix:Phoenixoverrideinit(){
phoenix =Phoenix(url:NSURL(string:"ws://sample.com/websocket")!)
super.init()
phoenix.connect()
phoenix.addListener(self, forChannel:"radio", event:"new_message")letmessage=PhoenixMessage(topic:"radio", event:"ping")
phoenix.send(message){(message:PhoenixMessage, error:NSError?)inguard error ==nilelse{print(error)return}print(message)print(message.response!.payload)}}func phoenix(phoenix:Phoenix, didReceive message:PhoenixMessage){print("Received message: \(message)")}func phoenix(phoenix:Phoenix, didJoin topic:String){print("Channel \(topic) joined")}func phoenix(phoenix:Phoenix, didClose topic:String, error:NSError?){print("Channel \(topic) closed with error: \(error)")}func phoenixDidConnect(phoenix:Phoenix){print("Phoenix connected")}func phoenixDidDisconnect(phoenix:Phoenix, error:NSError?){print("Phoenix disconnected")}}

About

Easy interaction with Phoenix Framework

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages