Author

Topic: Mtgox Websockets API only working sometimes (Read 1771 times)

jav
sr. member
Activity: 249
Merit: 251
September 16, 2013, 06:06:40 PM
#6
My understanding is, that Mt.Gox offers two streaming interfaces: Socket.IO and Websockets. Socket.IO has the option of using Websockets as one of the underlying transport mechanisms, but it still seems to be dealt with differently by Mt.Gox's server. I have long used Socket.IO for Bridgewalker (when I launched it was the only option available, as far as I know) and had lots of issues with it. It was very unreliable and actually got even more unreliable in the last couple of weeks. I have now recently switched to a pure Websocket implemention (using wss://websocket.mtgox.com/mtgox as the endpoint) and so far that seems to be more stable. So I would suggest replacing Socket.IO with a pure Websocket implementation.
newbie
Activity: 21
Merit: 0
September 16, 2013, 04:19:45 PM
#5
Quote
I now consider to use their REST API, since this behavior is unacceptable for production.

I was using their REST API until I realized that sometimes it would just give flat out incorrect data.
Jan
legendary
Activity: 1043
Merit: 1002
full member
Activity: 142
Merit: 100
Hive/Ethereum
September 04, 2013, 05:56:26 PM
#3
Has anyone else had this problem? Is there some way to fix it? am I doing something wrong?

Yes. No. Yes, relying on MtGox websockets after a long track record of crap websockets.
newbie
Activity: 12
Merit: 0
September 04, 2013, 03:59:57 PM
#2
Hi,
I can confirm this issue.
I have a sokcet.io connected to mtgox in nodejs environment.
I also get the same behavior.

I now consider to use their REST API, since this behavior is unacceptable for production.

Hope this helps,
Ofer
newbie
Activity: 21
Merit: 0
I have a class which collects data from mtgox (written in coffeescript) using websockets. The trouble is that it only works sometimes. I never change the code but sometimes when I start it, it will continually log in on message and other times it wont. If it dosent start right off the bat, regardless of how long I leave it on it will not begin to work. However if I restart the process it may start immediately or it may once again not work. It seems totally random.

Has anyone else had this problem? Is there some way to fix it? am I doing something wrong?

here's my code

events = require 'events'
io = require 'socket.io-client'
colors = require 'colors'
config = require "../config/config"
module.exports = class Mtgox extends events.EventEmitter

    constructor: () ->

        @socket = io.connect(config.MTGOX_WEBSOCKET_URL)
        @channels = config.MTGOX_CHANNELS

        @socket.on('connect', () =>
            console.log "in main on connect"
            @socket.on('message', (message) =>
                console.log "in on message"
                @emit(message.private, message[message.private])
            )
        )
Jump to: