cryptoqween / cryptoqween.github.io

CryptoCompare API tutorials
194 stars 114 forks source link

Not getting messages #2

Closed kellabyte closed 4 years ago

kellabyte commented 7 years ago

I'm connecting fine to the socket.io server but I am not getting any messages from subscriptions. I would appreciate if you could point out what I'm doing wrong.

    client, err := gosocketio.Dial(
        gosocketio.GetUrl("streamer.cryptocompare.com", 443, true),
        transport.GetDefaultWebsocketTransport())

    if err != nil {
        logrus.Fatal(err)
    }
    watcher.client = client

    err = watcher.client.On("m", func(h *gosocketio.Channel, args Message) {
        logrus.Println("--- Got message: ", args)
    })
    if err != nil {
        logrus.Fatal(err)
    }

    err = watcher.client.On(gosocketio.OnDisconnection, func(h *gosocketio.Channel) {
        logrus.Fatal("Disconnected")
    })
    if err != nil {
        logrus.Fatal(err)
    }

    err = watcher.client.On(gosocketio.OnConnection, func(h *gosocketio.Channel) {
        logrus.Println("Connected")
    })
    if err != nil {
        logrus.Fatal(err)
    }

    watcher.client.Emit("SubAdd", "{ subs: ['0~Poloniex~BTC~USD'] }")
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.