Bitcoin Forum
December 11, 2016, 06:34:00 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: MtGox Streaming API is Broken  (Read 2070 times)
eldentyrell
Donator
Legendary
*
Offline Offline

Activity: 966


felonious vagrancy, personified


View Profile WWW
February 05, 2012, 10:20:34 PM
 #1

Here is a self-contained piece of code that demonstrates the problem:

Code:
import io.socket.*;
import org.json.*;
import net.tootallnate.websocket.*;

public class MtGoxStreaming {
    
    private static final String tickerChannel = "d5f06780-30a8-4a48-a2f8-7ed181b4a13f";
    private static final String tradesChannel = "dbf1dee9-4f2e-4a08-8cb7-748919a71b21";
    private static final String depthChannel  = "24e67e0d-1cad-4cc0-9e7a-f8523ef460fe";

    public static void main(String[] args) throws Exception {
        SocketIO socket = new SocketIO("https://socketio.mtgox.com/mtgox");
        socket.connect(new IOCallback() {
                @Override
                    public void onMessage(JSONObject json, IOAcknowledge ack) {
                    try {
                        System.out.println("We received a message: " + json.toString(2));
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                    public void onMessage(String data, IOAcknowledge ack) {
                    System.out.println("We received a message:" + data);
                }
                
                @Override
                    public void onError(SocketIOException socketIOException) {
                    System.out.println("Something went wrong: " + socketIOException);
                    socketIOException.printStackTrace();
                    //System.exit(0);
                }

                @Override
                    public void onDisconnect() {
                    System.out.println("Disconnected");
                    System.exit(0);
                }

                @Override
                    public void onConnect() {
                    System.out.println("Connected");
                }

                @Override
                    public void on(String event, IOAcknowledge ack, Object... args) {
                    System.out.println("got: " + event);
                    ack.ack("Roger that!");
                    //socket.emit("answer", new JSONObject().put("msg", "Hello again Socket.io!"));
                }
            });

        // This will be cached until the server is connected.
        //socket.emit("hello", new JSONObject().put("msg", "Hello Socket.io! :D"));
 
        JSONObject obj = new JSONObject();
        obj.put("op",      "subscribe");
        //obj.put("channel", depthChannel);
        obj.put("channel", "d5f06780-30a8-4a48-a2f8-7ed181b4a13f");
        socket.send(obj);
 
    }
}

Run it and you get:

Code:
Connected
> 1::/mtgox
> 4::/mtgox:{"op":"subscribe","channel":"d5f06780-30a8-4a48-a2f8-7ed181b4a13f"}
> 2::
> 2::
> 2::
> 2::
> 2::
> 2::
> 2::
< 7:::1+0
Something went wrong: io.socket.SocketIOException: 1+0
io.socket.SocketIOException: 1+0

The printing press heralded the end of the Dark Ages and made the Enlightenment possible, but it took another three centuries before any country managed to put freedom of the press beyond the reach of legislators.  So it may take a while before cryptocurrencies are free of the AML-NSA-KYC surveillance plague.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
runeks
Legendary
*
Offline Offline

Activity: 924



View Profile WWW
February 22, 2012, 10:28:59 PM
 #2

I wish they could just re-enable the old socket API. It was working fine for me. I can't get the new one to work either (with Python).
MagicalTux
VIP
Hero Member
*
Offline Offline

Activity: 617


Working on new MtGox features


View Profile WWW
February 23, 2012, 12:43:04 AM
 #3

I wish they could just re-enable the old socket API. It was working fine for me. I can't get the new one to work either (with Python).

Actually the old one was disabled because it was causing too much strain on the system. We are working on a viable solution (socket.io seemed to be used by some big players, but after testing this ourselves we found out it's far from being stable at all).

Anyway we got another option currently on planning stage that may go live by end of may if socket.io do not fix their thing by then.

Serge
Legendary
*
Offline Offline

Activity: 1050


View Profile
February 23, 2012, 07:24:14 AM
 #4

with broken live data feed/s you're missing an action  /me thinks
toffoo
Sr. Member
****
Offline Offline

Activity: 392



View Profile
February 23, 2012, 11:22:03 PM
 #5

Anyway we got another option currently on planning stage that may go live by end of may ...

What is your current recommendation for people who need a stable live price feed?

The current socket.io and/or websockets feeds have been really awful the past few days/(weeks?).  While occasionally seeming to work at times, they often go down for hours at a time, pretty much every day.

What do sites like Bitcoinica, trading bots, or merchant sites do when the Mt.Gox feed goes down for hours at a time?

Is "maybe wait until the end of May" the only option here?

Seal
Donator
Hero Member
*
Offline Offline

Activity: 833


View Profile WWW
February 25, 2012, 04:56:26 AM
 #6

Anyway we got another option currently on planning stage that may go live by end of may ...

What is your current recommendation for people who need a stable live price feed?

The current socket.io and/or websockets feeds have been really awful the past few days/(weeks?).  While occasionally seeming to work at times, they often go down for hours at a time, pretty much every day.

What do sites like Bitcoinica, trading bots, or merchant sites do when the Mt.Gox feed goes down for hours at a time?

Is "maybe wait until the end of May" the only option here?


The JSON web API with post/get calls.

*edit* actually i just realised you asked for live feed... the json calls aren't live.

daybyter
Legendary
*
Offline Offline

Activity: 965


View Profile
February 26, 2012, 08:09:02 PM
 #7

Wouldn't it be easier to get the json server update more often?  How quick is enough 'real time'?

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!