Latest 0.1.3
License MIT
Platforms ios 10.0, requires ARC
Dependencies CocoaAsyncSocket, RxSwift
Frameworks Foundation

MIT licensed


RxSTOMP is a variation of STOMP client, written in Swift3, using RxSwift and CocoaAsyncSocket.


Quickly install using CocoaPods:

pod 'RxSTOMP'

Or manually install:

  1. Clone this repository
  2. Copy Core folder to your project
  3. Don’t forget to install RxSwift dependency
  4. Profit

There’s also Example with simple usage how-to.

How to use

First of all don’t forget to configure host and port of your STOMP server: = ""
  RxSTOMPConfiguration.Network.port = 7691

RxSTOMPConfiguration is a struct, where defined a lot of parameters, such as Read&Write timeouts, Tags, Queues, Host configuration

Then you need to initialize RxSTOMPStream object, which is responsible for handling socket connection and everything.
You can do it either just init with default initializer:

let rxStompStream = RxSTOMPStream()

Or using DI, for example Swinject:

   let container = Container() { container in        
        // Models
        container.register(RxSTOMPStreamProtocol.self) { _ in RxSTOMPStream() }

        // Views
        container.storyboardInitCompleted(ExampleViewController.self) {r,c in
            c.viewModel = r.resolve(ExampleViewModel.self)!

        //View models
        container.register(ExampleViewModel.self) { r
            in ExampleViewModel(stompStream: r.resolve(RxSTOMPStreamProtocol.self)!)

Then after you connect, you just subscribe to two types of events: state and incoming frames:


func subscribeToState() {
    .observeOn(SerialDispatchQueueScheduler(queue: RxSTOMPConfiguration.Queue.stompQueue, internalSerialQueueName: "stomp"))
    .filter { $0 == .connected } //after we connected -> do some stuff
    .subscribe(onNext: {[weak self] _ in
        guard let sSelf = self else { return }
        guard let login = sSelf.login, let passcode = sSelf.passcode else { return }
        sSelf.rxStompStream.auth(login: login, passcode: passcode)

//subscribe to incoming messages, like CONNECT, DISCONNECT, MESSAGE and etc...
 func subscribeToFrames() {
    .observeOn(SerialDispatchQueueScheduler(queue: RxSTOMPConfiguration.Queue.stompQueue, internalSerialQueueName: "stomp"))
    .subscribe(onNext: { inputFrame in
       print("input frame: (inputFrame)")

Latest podspec

    "name": "RxSTOMP",
    "platforms": {
        "ios": "10.0"
    "summary": "Simple implementation of STOMP protocol via CocoaAsyncSocket and RxSwift",
    "requires_arc": true,
    "version": "0.1.3",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Pavel Shatalov": "[email protected]"
    "homepage": "",
    "source": {
        "git": "",
        "tag": "0.1.3"
    "frameworks": "Foundation",
    "dependencies": {
        "CocoaAsyncSocket": [],
        "RxSwift": []
    "source_files": "RxSTOMP/**/*.{swift}",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This