Swiftpack.co - Package - fjcaetano/RxWebSocket


Build Status Version License Platform codecov Carthage compatible

Reactive extensions for websockets.

A lightweight abstraction layer over Starscream to make it reactive.


RxWebSocket is available through CocoaPods and Carthage. To install it, simply add the following line to your depedencies file:


pod "RxWebSocket"


github "fjcaetano/RxWebSocket"


Every websocket event will be sent to the stream which is an Observable<StreamEvent>.

  public enum StreamEvent {
    case connect
    case disconnect(Error?)
    case pong
    case text(String)
    case data(Data)

You may receive and send text events by subscribing to the text property:

let label = UILabel()
    .bind(to: label.rx.text)

    .flatMap { textField.text ?? "" }
    .bind(to: socket.rx.text)

For further details, check the Example project.


After cloning the project, pull all submodules with

git submodule update --init --recursive


RxWebSocket relies on the following for development:

To install all dependencies without hassles just run:


Which will install all the dependencies and virtual envs if necessary.

Running Tests

Xcode and Fastlane will take care of starting and stopping websocket echoservers for testing, however if you find that tests are timing out, this is usually a sign that the server is not running. If so, you can manage it running

./server.sh {start|stop|restart|status}

This will tell wstests to launch an echo server on If this port is unusable for you by any reason, you may change it in the server.sh file.

Help Wanted

Do you love RxWebsocket and work actively on apps that use it? We'd love if you could help us keep improving it! Feel free to message us or to start contributing right away!


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


Stars: 44
Help us keep the lights on

Used By

Total: 1


2.1.0 - Dec 10, 2018

Swift 4.2 support

2.0.0 - Nov 13, 2017

  • Swift 4 support
  • Carthage compatibility
  • Swift Package Manager compatibility