cryptoqween / cryptoqween.github.io

CryptoCompare API tutorials
194 stars 114 forks source link

Not able to get data with websocket #24

Closed imobdevtech closed 6 years ago

imobdevtech commented 6 years ago

Hello I try to get current stream data with below code but got nothing in response. Here is my code


static let sharedInstance = SocketIOManager()

//    let socketManager = SocketManager(socketURL: URL(string: "https://streamer.cryptocompare.com/")!, config: [.log(true),.forceWebsockets(true),.compress])
    let socketManager = SocketManager(socketURL: URL(string: "https://streamer.cryptocompare.com/")!, config: [.log(true)])

    var socket : SocketIOClient!
    override init() {
        super.init()
        socket = socketManager.defaultSocket

        socket.onAny {
            print("Any Got event: \($0.event), with items: \($0.items!)")

        }

        socket.on("m") { dataArray, ack in

            let subscription = ["5~CCCAGG~BTC~USD"];
            self.socket.emitWithAck("SubAdd", subscription).timingOut(after: 0) {data in
                self.socket.emit("SubAdd", subscription)
            }
        }
        socket.connect()

    }

System infomation Swift ver : 3.0 Xcode ver : 9.2

imobdevtech commented 6 years ago

Find the solution from this link

cryptoqween commented 4 years ago

Hi there, just wanted to let you know that this version of the streaming API is being sunset in the next couple of weeks as we are moving to version 2, that has a lot more features and better support. Please visit our documentation page which provides code examples in javascript, node, python and golang: https://min-api.cryptocompare.com/documentation/websockets.