Bitcoin Forum
April 26, 2024, 01:13:41 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: MtGox Streaming API is Broken  (Read 2261 times)
eldentyrell (OP)
Donator
Legendary
*
Offline Offline

Activity: 980
Merit: 1004


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.
1714094021
Hero Member
*
Offline Offline

Posts: 1714094021

View Profile Personal Message (Offline)

Ignore
1714094021
Reply with quote  #2

1714094021
Report to moderator
No Gods or Kings. Only Bitcoin
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714094021
Hero Member
*
Offline Offline

Posts: 1714094021

View Profile Personal Message (Offline)

Ignore
1714094021
Reply with quote  #2

1714094021
Report to moderator
1714094021
Hero Member
*
Offline Offline

Posts: 1714094021

View Profile Personal Message (Offline)

Ignore
1714094021
Reply with quote  #2

1714094021
Report to moderator
1714094021
Hero Member
*
Offline Offline

Posts: 1714094021

View Profile Personal Message (Offline)

Ignore
1714094021
Reply with quote  #2

1714094021
Report to moderator
runeks
Legendary
*
Offline Offline

Activity: 980
Merit: 1008



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: 608
Merit: 501


-


View Profile
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
Merit: 1000


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: 408
Merit: 261



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: 848
Merit: 1078


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.

DefiDive - Filter the noise
A clean crypto asset management terminal
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


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:  

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