Skip to content

Server Sent Events (SSE) parser operators for ReactiveSwift

License

Notifications You must be signed in to change notification settings

tarag/ReactiveSSE

This branch is 24 commits behind banjun/ReactiveSSE:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

97055b8 · May 13, 2019

History

24 Commits
May 13, 2019
Nov 24, 2017
May 13, 2019
Nov 24, 2017
Nov 24, 2017
Feb 2, 2019
Feb 2, 2019
Nov 23, 2017
Nov 24, 2017
Nov 24, 2017
Nov 24, 2017
May 13, 2019
Nov 23, 2017

Repository files navigation

ReactiveSSE

CI Status Version License Platform

ReactiveSSE is a ReactiveSwift.SignalProducer acting as Server-Sent Events (SSE) parser. https://www.w3.org/TR/eventsource/

SSE stream is buffered and parsed in a background queue and can be observed via its signal.

Usage

let sse = ReactiveSSE(urlRequest: URLRequest(url: URL(string: endpoint)!))
sse.producer.observe(on: QueueScheduler.main).startWithValues { (v: SSEvent) in
    v.type // String: "message", "update", or whatever
    v.data // String: json payload string, any value string, or whatever
}

Example

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

Requirements

Installation

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

pod 'ReactiveSSE'

Author

@banjun

License

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

About

Server Sent Events (SSE) parser operators for ReactiveSwift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 81.3%
  • Ruby 18.7%