Latest 4.0.3
Homepage https://github.com/SlackKit/SKRTMAPI
License MIT
Platforms ios 9.0, osx 10.11, tvos 9.0, requires ARC
Dependencies SKCore, SKWebAPI, Starscream
Frameworks Foundation
Authors

SKRTMAPI: SlackKit RTM Module

Swift Version
Plaforms
License MIT
SwiftPM compatible
Carthage compatible
CocoaPods compatible

A module for connecting to the Slack Real Time Messaging API.

Installation

CocoaPods

Add SKRTMAPI to your pod file:

use_frameworks!
pod 'SKRTMAPI'

and run

# Use CocoaPods version >= 1.1.0
pod install

Carthage

Add SKRTMAPI to your Cartfile:

github "SlackKit/SKRTMAPI"

and run

carthage bootstrap

Drag the built SKRTMAPI.framework into your Xcode project.

Swift Package Manager

Add SKRTMAPI to your Package.swift

import PackageDescription

let package = Package(
    dependencies: [
        .Package(url: "https://github.com/SlackKit/SKRTMAPI.git", majorVersion: 4)
    ]
)

Run swift build on your application’s main directory.

To use the library in your project import it:

import SKRTMAPI

Usage

Initialize an instance of SKRTMAPI with a Slack auth token:

let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN")
rtm.connect()

If your bot doesn’t need any state information when you connect, pass false for the withInfo parameter:

let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN")
rtm.connect(withInfo: false)

Customize the connection with RTMOptions:

let options = RTMOptions(simpleLatest: false, noUnreads: false, mpimAware: true, pingInterval: 30, timeout: 300, reconnect: true)
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN", options: options)
rtm.connect()

Provide your own web socket implementation by conforming to RTMWebSocket:

public protocol RTMWebSocket {
    init()
    var delegate: RTMDelegate? { get set }
    func connect(url: URL)
    func disconnect()
    func sendMessage(_ message: String) throws
}
let rtmWebSocket = YourRTMWebSocket()
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN", rtm: rtmWebSocket)
rtm.connect()

Latest podspec

{
    "name": "SKRTMAPI",
    "version": "4.0.3",
    "summary": "A Swift library for connecting to the Slack RTM API",
    "homepage": "https://github.com/SlackKit/SKRTMAPI",
    "license": "MIT",
    "authors": {
        "Peter Zignego": "[email protected]"
    },
    "source": {
        "git": "https://github.com/SlackKit/SKRTMAPI.git",
        "tag": "4.0.3"
    },
    "social_media_url": "https://twitter.com/pvzig",
    "platforms": {
        "ios": "9.0",
        "osx": "10.11",
        "tvos": "9.0"
    },
    "requires_arc": true,
    "source_files": "Sources/**/*.swift",
    "frameworks": "Foundation",
    "dependencies": {
        "SKCore": [],
        "SKWebAPI": [],
        "Starscream": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This