File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ A lightweight extension to [Starscream](https://github.com/daltoniam/Starscream)
1010
1111## Installation
1212
13- ###CocoaPods
13+ ### CocoaPods
1414
1515RxStarscream is available through [ CocoaPods] ( http://cocoapods.org/ ) .
1616
@@ -26,7 +26,7 @@ To use RxStarscream in your project add the following 'Podfile' to your project
2626Then run:
2727 pod install
2828
29- ###Carthage
29+ ### Carthage
3030
3131Add this to Cartfile
3232
@@ -47,13 +47,13 @@ Once imported, you can open a connection to your WebSocket server.
4747
4848``` swift
4949
50- socket = RxWebSocket (url : NSURL (string : " ws://localhost:8080/" )! )
50+ socket = WebSocket (url : NSURL (string : " ws://localhost:8080/" )! )
5151socket.connect ()
5252```
5353Now you can subscribe e.g to all of the websocket events:
5454
5555``` swift
56- socket.rx_response .subscribeNext { (response : WebSocketEvent) in
56+ socket.rx . response .subscribeNext { (response : WebSocketEvent) in
5757 switch response {
5858 case .Connected :
5959 print (" Connected" )
@@ -69,6 +69,15 @@ socket.rx_response.subscribeNext { (response: WebSocketEvent) in
6969}.addDisposableTo (disposeBag)
7070```
7171
72+
73+ Or just to a connect event:
74+
75+ ``` swift
76+ socket.rx .connected .subscribeNext { (isConnected : Bool ) in
77+ print (" Is connected : \( isConnected ) " )
78+ }.addDisposableTo (self .disposeBag )
79+ ```
80+
7281Or just to a message event:
7382
7483``` swift
You can’t perform that action at this time.
0 commit comments