CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

ACWebSocketClient 0.1.9

ACWebSocketClient 0.1.9

Maintained by Joe McMahon.



ACWebSocketClient

CI Status Version License Platform

An Azuracast websocket SSE metadata client written in Swift

If you've set up an Azuracast streaming radio station and attempted to use the Apple-recommended way of fetching the stream metadata, you will discover that you never get any updates.

Whether this is a bug in Apple's code or in Azuracast's code is a moot point; as things currently stand (December 2024), the stream metadata can't be fetched with the standard interface.

Azuracast SSE

Fortunately, Azuracast supplies a now-playing data interface that can push the stream metadata updates to you via either websockets or server-side events. This module uses the websocket interface to fetch the data. Updates are close to real-time, sent as JSON.

Notes

The JSON is slightly non-standard; in particular, there is one key which doesn't conform to the key naming conventions that Codable uses, so it's necessary to use JSONSerialization to transform the JSON into nested Dictionary<String, Any> structs and manually chase down the substructures.

The high-frequency now-playing interface provide a lot more data than the standard metadata interface. In addition to the track name and artist name, we get the album, any data available about a live streamer, the next song up (if available), and the song play history, with all the same info as the current and next song.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ACWebSocketClient is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ACWebSocketClient'

Author

joemcmahon, [email protected]

License

ACWebSocketClient is available under the MIT license. See the LICENSE file for more info.