Bitcoin Forum
December 05, 2025, 11:48:44 AM *
News: Latest Bitcoin Core release: 30.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: « 1 2 3 4 5 6 [7] 8 9 10 11 12 13 14 15 16 17 18 19 20 21 »  All
  Print  
Author Topic: [BETA] MTGox websocket API, testers wanted  (Read 78111 times)
piotr_n
Legendary
*
Offline Offline

Activity: 2058
Merit: 1439


aka tonikt


View Profile WWW
October 31, 2011, 04:29:49 PM
 #121

http://mtgoxlive.com/ is also suffering from this failure.
The data is shows doesn't seem to be in a real time anymore.
And this service had supposedly been acquired by MtGox.
So he should care Smiley

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
BTCurious
Hero Member
*****
Offline Offline

Activity: 714
Merit: 504


^SEM img of Si wafer edge, scanned 2012-3-12.


View Profile
October 31, 2011, 04:44:15 PM
 #122

http://mtgoxlive.com/ is also suffering from this failure.
The data is shows doesn't seem to be in a real time anymore.
And this service had supposedly been acquired by MtGox.
So he should care Smiley
I'm not sure that's true. If I compare it to the fastest monitor bot I know, #bitcoin-RT in freenode, then the number seems to be behind ~10 seconds. But I don't remember this ever being any different.

piotr_n
Legendary
*
Offline Offline

Activity: 2058
Merit: 1439


aka tonikt


View Profile WWW
October 31, 2011, 04:55:37 PM
 #123

Before you could see new transactions popping up on the right side, in a real time.
And the green price line was also updated in a real time - now the last point of it is always a couple of minutes behind.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
BTCurious
Hero Member
*****
Offline Offline

Activity: 714
Merit: 504


^SEM img of Si wafer edge, scanned 2012-3-12.


View Profile
October 31, 2011, 05:04:29 PM
Last edit: October 31, 2011, 09:58:26 PM by BTCurious
 #124

Before you could see new transactions popping up on the right side, in a real time.
And the green price line was also updated in a real time - now the last point of it is always a couple of minutes behind.
Oh hey, you could be right. It did work via the websocket before. Maybe it works via the http API now?

Edit: Websocket is back. And yeah, the transactions in real time too.

runeks
Legendary
*
Offline Offline

Activity: 980
Merit: 1008



View Profile WWW
October 31, 2011, 11:42:57 PM
 #125

Yay, websocket is back. Thanks Mt. Gox.
piotr_n
Legendary
*
Offline Offline

Activity: 2058
Merit: 1439


aka tonikt


View Profile WWW
November 01, 2011, 11:46:07 AM
 #126

Yay, websocket is back. Thanks Mt. Gox.
I saw it back for a moment... but it doesn't work now, does it?

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
molecular
Donator
Legendary
*
Offline Offline

Activity: 2800
Merit: 1023



View Profile
November 01, 2011, 01:40:23 PM
 #127

Yay, websocket is back. Thanks Mt. Gox.
I saw it back for a moment... but it doesn't work now, does it?

It's working for me in my own client. Thanks MagicalTux!

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
piotr_n
Legendary
*
Offline Offline

Activity: 2058
Merit: 1439


aka tonikt


View Profile WWW
November 01, 2011, 01:46:48 PM
 #128

It's working for me in my own client.
OK - thanks for the info.
This made me thinking... and it seems that I upgraded my websocket libarary to a new version.
It's OK when I go back to the old version. Its probably the same problem as with a new Chrome.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
molecular
Donator
Legendary
*
Offline Offline

Activity: 2800
Merit: 1023



View Profile
November 01, 2011, 01:48:18 PM
 #129

It's working for me in my own client.
OK - thanks for the info.
This made me thinking... and it seems that I upgraded my websocket libarary to a new version.
It's OK when I go back to the old version. Its probably the same problem as with a new Chrome.

Thanks for that hint. I'll keep that in mind, cause I'll probably switch websocket impl at some point (currently using some hacked-up thingy someone gave me).

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
runeks
Legendary
*
Offline Offline

Activity: 980
Merit: 1008



View Profile WWW
November 01, 2011, 02:07:52 PM
 #130

Yay, websocket is back. Thanks Mt. Gox.
I saw it back for a moment... but it doesn't work now, does it?
Works for me right now as well.
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
November 19, 2011, 12:40:08 AM
Last edit: November 20, 2011, 01:07:41 AM by slush
 #131

Anyone succeed with new MtGox's socket.io interface? I was succesfull with socket.io handshake, server returned "12906784121696250629:15:25:websocket,flashsocket,htmlfile,xhr-polling,jsonp-polling". But then I open WS connection to ws://socketio.mtgox.com:80/socket.io/1/websocket/12906784121696250629 and nothing happen, client don't receive any data. Am I doing anything wrong?

molecular
Donator
Legendary
*
Offline Offline

Activity: 2800
Merit: 1023



View Profile
November 20, 2011, 12:52:37 AM
 #132

Anyone succeed with new MtGox's socket.io interface? I was succesfull with socket.io handshake, server returned "12906784121696250629:15:25:websocket,flashsocket,htmlfile,xhr-polling,jsonp-polling". But then I open WS connection to ws://socketio.mtgox.com:80/mtgox/socket.io/1/websocket/12906784121696250629 and nothing happen, client don't receive any data. Am I doing anything wrong?

I did succeed implementing mtgox socket.io client in my trading client. I used the websocket implementation I used before, coded the handshake.

I remember one time where the socket.io would work, websocket would even connect, but no data being delivered. Maybe this problem just reappeared.

It's working as expected for me now.

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
November 20, 2011, 01:07:25 AM
 #133

Thanks for info. Is following websocket URL correct?

ws://socketio.mtgox.com:80/socket.io/1/websocket/1290678412169625062

I did succeed implementing mtgox socket.io client in my trading client. I used the websocket implementation I used before, coded the handshake.

I remember one time where the socket.io would work, websocket would even connect, but no data being delivered. Maybe this problem just reappeared.

It's working as expected for me now.


jothan
Full Member
***
Offline Offline

Activity: 184
Merit: 100


Feel the coffee, be the coffee.


View Profile
November 23, 2011, 04:37:50 AM
Last edit: November 23, 2011, 04:56:27 AM by jothan
 #134

Thanks for info. Is following websocket URL correct?

ws://socketio.mtgox.com:80/socket.io/1/websocket/1290678412169625062

I did succeed implementing mtgox socket.io client in my trading client. I used the websocket implementation I used before, coded the handshake.

I remember one time where the socket.io would work, websocket would even connect, but no data being delivered. Maybe this problem just reappeared.

It's working as expected for me now.


With the URL above, I get a weird reply from the server "7:::1+0", using the supposed official URL, wss://socketio.mtgox.com/mtgox, the server just closes the connection after the SSL handshake.

Very weird.

Edit: I just figured out that using a WebSockets library is not enough, I have just figured out that socket.io was a whole other layer on top of WebSockets.

Bitcoin: the only currency you can store directly into your brain.

What this planet needs is a good 0.0005 BTC US nickel.
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
November 23, 2011, 03:17:15 PM
 #135

With the URL above, I get a weird reply from the server "7:::1+0", using the supposed official URL, wss://socketio.mtgox.com/mtgox, the server just closes the connection after the SSL handshake.

Very weird.

Yes, you received socket.io handshake response, it's fine. socket.io != websocket.

Quote
Edit: I just figured out that using a WebSockets library is not enough, I have just figured out that socket.io was a whole other layer on top of WebSockets.

Does it work for you? I dropped idea of get it working after playing with it for hours. Lacking documentation, multiple versions of specifications, total mess.

Then I implemented bitcoincharts socket interface in 15 minutes...

jothan
Full Member
***
Offline Offline

Activity: 184
Merit: 100


Feel the coffee, be the coffee.


View Profile
November 23, 2011, 03:36:28 PM
 #136

With the URL above, I get a weird reply from the server "7:::1+0", using the supposed official URL, wss://socketio.mtgox.com/mtgox, the server just closes the connection after the SSL handshake.

Very weird.

Yes, you received socket.io handshake response, it's fine. socket.io != websocket.

Quote
Edit: I just figured out that using a WebSockets library is not enough, I have just figured out that socket.io was a whole other layer on top of WebSockets.

Does it work for you? I dropped idea of get it working after playing with it for hours. Lacking documentation, multiple versions of specifications, total mess.

Then I implemented bitcoincharts socket interface in 15 minutes...

I can now connect fine, but I cannot subscribe to any channel, I get "invalid request" or "invalid command", so I cannot do anything useful yet. I'm gonna try interfacing bitcoincharts tonight.

Bitcoin: the only currency you can store directly into your brain.

What this planet needs is a good 0.0005 BTC US nickel.
jothan
Full Member
***
Offline Offline

Activity: 184
Merit: 100


Feel the coffee, be the coffee.


View Profile
November 23, 2011, 10:55:13 PM
 #137

Could someone comment on the following points ?

  • Is the stream API service currently in a usable state ? (I cannot determine this since I cannot subscribe to any channel).
  • What is the proper way to subscribe to a channel ?

Given answers to this, I would be willing to update the wiki with the up-to-date information to clear up the usage of this API.

Heck, i'll give 1 BTC to whomever can enable me to stream prices directly from Mt. Gox with this API.

Bitcoin: the only currency you can store directly into your brain.

What this planet needs is a good 0.0005 BTC US nickel.
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
November 23, 2011, 11:02:13 PM
 #138

Same status here, lack of any documentation is pretty irritating.

molecular
Donator
Legendary
*
Offline Offline

Activity: 2800
Merit: 1023



View Profile
November 24, 2011, 02:58:37 PM
 #139

Same status here, lack of any documentation is pretty irritating.

magicaltux has some php sample code that was helpfull for me to code socket.io handshake in python.

(it's still got some debugging output and heartbeat lost detection is not implemented, so on connection drop it doesn't auto-reconnect). oh, and it only does websocket, no other transport.

Quote from: socketio.py
from threading import *
import urllib2, urllib
import simplejson as json
import ssl, socket
import time
from websocket import WebSocket


class SocketIO:
  def __init__(S, url, callback):
    S.url = url
    S.callback = callback
    
  def connect(S):
    data = urllib.urlencode({})
    req = urllib2.Request('https://' + S.url + "/1", data)
    response = urllib2.urlopen(req)
    r = response.read().split(':')
    S.heartbeat_interval = int(r[1])
    print 'heartbeat: ', S.heartbeat_interval
    if 'websocket' in r[3].split(','):
      print "good: transport 'websocket' supported by socket.io server ", S.url
      S.id = r[0]
      print "id: ", S.id

    S.thread = Thread(target = S.thread_func)
    S.thread.setDaemon(True)
    S.thread.start()

  def stop(S):
    S.run = False
    S.thread.join(timeout=1)
    S.keepalive_thread.join(timeout=1)


  def thread_func(S):
    print 'SocketIO: websocket thread started'
    
    my_url = 'wss://' + S.url + "/1/websocket/" + S.id
    
    S.ws = WebSocket(my_url, version=0)
    S.run = True
    S.ws.send('1::/mtgox')

    # start keepalive thread
    S.keepalive_thread = Thread(target = S.keepalive_func)
    S.keepalive_thread.setDaemon(True)
    S.keepalive_thread.start()
    
    msg = S.ws.recv()
    while msg is not None and S.run:
      #print 'SocketIO msg: ', msg
      if msg[:10] == "4::/mtgox:":
        S.callback(msg[10:])
      #elif msg[:3] == "2::":
      #  True
      #else:
      #  print "SocketIO: dont know how to handle msg: ", msg
      msg = S.ws.recv()
      
  def keepalive_func(S):
    while S.run:
      time.sleep(S.heartbeat_interval)
      S.ws.send('2::');
      
def test_callback(msg):
  print 'msg: ', msg

# testcase
if True:
  sio = SocketIO('socketio.mtgox.com/socket.io', test_callback)
  sio.connect()
  time.sleep(100)


I got that websocket implementation from giel (on irc) ("from websocket import WebSocket"), here it is (put in file websocket/__init__.py):

  http://pastebin.com/jrxachSF

You can start using

  #> python socketio.py

it should dump the messages to stdout

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
November 24, 2011, 03:04:42 PM
 #140

Quote
    S.ws.send('1::/mtgox')

*headdesk*
* slush bashing all developers writing incomplete documentations and expecting that some things are so obvious they don't need to be in doc.

molecular, you're my savior. What's your donation address?

Pages: « 1 2 3 4 5 6 [7] 8 9 10 11 12 13 14 15 16 17 18 19 20 21 »  All
  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!