Update README.md
A module for connecting to the Slack Real Time Messaging API.
Add SKRTMAPI to your pod file:
use_frameworks! pod 'SKRTMAPI'
and run
# Use CocoaPods version >= 1.4.0 pod install
Add SKRTMAPI to your Cartfile:
github "SlackKit/SKRTMAPI"
carthage bootstrap
Drag the built SKRTMAPI.framework into your Xcode project.
SKRTMAPI.framework
Add SKRTMAPI to your Package.swift
import PackageDescription let package = Package( dependencies: [ .package(url: "https://github.com/pvzig/SKRTMAPI.git", .upToNextMinor(from: "4.1.0")) ] )
Run swift build on your application’s main directory.
swift build
To use the library in your project import it:
import SKRTMAPI
Initialize an instance of SKRTMAPI with a Slack auth token:
SKRTMAPI
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:
false
withInfo
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN") rtm.connect(withInfo: false)
Customize the connection with RTMOptions:
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:
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()
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
SKRTMAPI has been consolidated into SlackKit
A module for connecting to the Slack Real Time Messaging API.
Installation
CocoaPods
Add SKRTMAPI to your pod file:
and run
Carthage
Add SKRTMAPI to your Cartfile:
and run
Drag the built
SKRTMAPI.framework
into your Xcode project.Swift Package Manager
Add SKRTMAPI to your Package.swift
Run
swift build
on your application’s main directory.To use the library in your project import it:
Usage
Initialize an instance of
SKRTMAPI
with a Slack auth token:If your bot doesn’t need any state information when you connect, pass
false
for thewithInfo
parameter:Customize the connection with
RTMOptions
:Provide your own web socket implementation by conforming to
RTMWebSocket
: