Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ras0q/swift-traq-ws
Swift client library for the traQ Websocket API.
https://github.com/ras0q/swift-traq-ws
Last synced: 2 months ago
JSON representation
Swift client library for the traQ Websocket API.
- Host: GitHub
- URL: https://github.com/ras0q/swift-traq-ws
- Owner: ras0q
- Created: 2022-08-29T01:26:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-09T16:48:15.000Z (about 2 years ago)
- Last Synced: 2024-08-02T14:06:40.801Z (5 months ago)
- Language: Swift
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# swift-traq-ws
Swift client library for the traQ **Websocket** API.
- for other API: [traPtitech/swift-traq](https://github.com/traPtitech/swift-traq)
- API spec: [traP Swagger Viewer](https://apis.trap.jp/#/notification/ws)Please install this package by SPM.
## Example
```swift
import TraqWebsocket// in function...
let wsClient = WsClient()// register process on specific event
wsClient.onEvent(type: .messageRead) { event in
// aquire payload struct
guard case let .messageRead(payload) = event.body else {
return
}print("receive \(event.type) event: \(payload)")
}// connect
wsClient.resume()
```