<commit_before>//
//  ViewController.swift
//  SwiftActionCableClient
//
//  Created by <NAME> on 04/14/2016.
//  Copyright (c) 2016 <NAME>. All rights reserved.
//

import UIKit
import SwiftyActionCable

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        // 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)
        }
        
        // 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")
        
        // send unsubscribe event to the server
//        exampleChannel.unSubscribe()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }<commit_msg>Fix Example<commit_after>//
//  ViewController.swift
//  SwiftActionCableClient
//
//  Created by <NAME> on 04/14/2016.
//  Copyright (c) 2016 <NAME>. All rights reserved.
//

import UIKit
import SwiftyActionCable

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        // 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")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
{'fraction_non_alphanumeric': 0.08255563531945441, 'fraction_numerical': 0.01148600143575018, 'mean_word_length': 2.221965317919075, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2489460', 'n_tokens_mistral': 755, 'n_tokens_neox': 699, 'n_words': 197}