ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - fjcaetano/RxWebSocket: Reactive WebSockets
Reactive WebSockets. Contribute to fjcaetano/RxWebSocket development by creating an account on GitHub.
Visit Site

GitHub - fjcaetano/RxWebSocket: Reactive WebSockets

GitHub - fjcaetano/RxWebSocket: Reactive WebSockets

RxWebSocket

Build Status codecov PRs welcome Carthage compatible SPM compatible Version License Platform


Reactive extensions for websockets.

A lightweight abstraction layer over Starscream to make it reactive.

Installation

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

Cocoapods

pod "RxWebSocket"

Carthage

github "fjcaetano/RxWebSocket"

Usage

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()
socket.rx.text
    .bind(to: label.rx.text)


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

For further details, check the Example project.

Contributing

After cloning the project, pull all submodules with

git submodule update --init --recursive

Requirements

RxWebSocket relies on the following for development:

To install all dependencies without hassles just run:

./install_dependencies.sh

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 127.0.0.1:9000. If this port is unusable for you by any reason, you may change it in the server.sh file.

Upgrading to a new Swift version

Upgrading a new Swift version requires upgrading the dependencies as well. Since the RxWebSocket is distributed through Cocoapods, Carthage and Swift Package Manager, the dependencies must be upgraded in the corresponding spec file for the three platforms:

Cocoapods

In RxWebSocket.podspec, update swift_version and the dependencies' versions at the end of the file

Carthage

Upgrade the dependencies' versions in Cartfile

Swift Package Manager

Upgrade the dependencies' versions in Package.swift

Housekeeping

Before commiting, make sure to run, at least, the test lane on Fastlane. This will run all iOS tests.

If you want to be thorough, which is recommended and appreciated, run the ci lane, which is the same lane Travis runs when testing PRs. This lane will run tests for iOS, tvOS and macOS, as well as lint the project for the three package managers. If this lane passes, you can be 100% sure everything is running as smoothly as possible.

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!

License

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

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory