Skip to content

Commit 20c0be6

Browse files
authored
Update README.md
1 parent f00e2a4 commit 20c0be6

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff 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

1515
RxStarscream 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
2626
Then run:
2727
pod install
2828

29-
###Carthage
29+
### Carthage
3030

3131
Add 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/")!)
5151
socket.connect()
5252
```
5353
Now 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+
7281
Or just to a message event:
7382

7483
```swift

0 commit comments

Comments
 (0)