Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnected with optional error : "Connection refused" #35

Open
azeemohd786 opened this issue Nov 12, 2020 · 0 comments
Open

Disconnected with optional error : "Connection refused" #35

azeemohd786 opened this issue Nov 12, 2020 · 0 comments

Comments

@azeemohd786
Copy link

When I tried to run the sample project with just basics to connect web socket, getting this error -Disconnected with optional error : Optional(Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused"

@_exported import RxSwift
@_exported import RxStarscream
import Starscream

  override func viewDidLoad() {
        super.viewDidLoad()
 private let disposeBag = DisposeBag()
 
socket = WebSocket(url: URL(string: "ws://localhost:8080/")!)
        socket.connect()

 socket.rx.response.subscribe(onNext: { (response: WebSocketEvent) in
            switch response {
            case .connected:
                print("Connected")
            case .disconnected(let error):
                print("Disconnected with optional error : \(error)")
            case .message(let msg):
                print("Message : \(msg)")
            case .data(_):
                print("Data")
            case .pong:
                print("Pong")
            }
        }).disposed(by: disposeBag)
}

am I doing anything wrong, I could find the solution..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant