Bitcoin Forum
May 27, 2024, 08:13:00 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Mtgox Websockets API only working sometimes  (Read 1762 times)
loourr (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
August 31, 2013, 11:29:48 PM
 #1

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])
            )
        )
ofer
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
September 04, 2013, 07: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
tgerring
Full Member
***
Offline Offline

Activity: 142
Merit: 100


Hive/Ethereum


View Profile WWW
September 04, 2013, 09: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.

Hive, a beautiful wallet for Mac OS X, now available for testing. Follow the story here.
BitcoinKit.framework and Tor.framework, now available to iOS and Mac OS X developers
Tweeting at @hivewallet. Donations appreciated at 142m1MpXHhymF4aASiWwYohe1Y55v5BQwc
Jan
Legendary
*
Offline Offline

Activity: 1043
Merit: 1002



View Profile
September 05, 2013, 03:39:26 PM
 #4

Maybe related to this: https://bitcointalk.org/index.php?topic=286422.0

Mycelium let's you hold your private keys private.
loourr (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
September 16, 2013, 08: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.
jav
Sr. Member
****
Offline Offline

Activity: 249
Merit: 251


View Profile
September 16, 2013, 10: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.

Hive, a beautiful wallet with an app platform for Mac OS X, Android and Mobile Web. Translators wanted! iOS and OS X devs see BitcoinKit. Tweets @hivewallet. Donations appreciated at 1HLRg9C1GsfEVH555hgcjzDeas14jen2Cn.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!