Bitcoin Forum
April 18, 2024, 02:54:12 PM *
News: Latest Bitcoin Core release: 26.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 77606 times)
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
September 20, 2011, 09:52:43 AM
 #101

The WebSocket API does not work with the latest Chrome. Sad

Chrome dev claims that the problem is at mtgox side.
Quote
It seems that websocket.mtgox.com is sending out a frame in old format (http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00). Chrome 14 uses new version WebSocket protocol (http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-08). We've dropped old protocol and are asking servers to adopt new one. mtgox is replying new version handshake correctly. Only new frame support looks broken.
http://code.google.com/p/chromium/issues/detail?id=97026

Please fix.

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
"I'm sure that in 20 years there will either be very large transaction volume or no volume." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713452052
Hero Member
*
Offline Offline

Posts: 1713452052

View Profile Personal Message (Offline)

Ignore
1713452052
Reply with quote  #2

1713452052
Report to moderator
AV
Hero Member
*****
Offline Offline

Activity: 910
Merit: 1000



View Profile
September 20, 2011, 12:56:57 PM
 #102

Hi, MagicalTux !

The WebSocket API really does not work with the latest (14.0.835.163) Chrome.


For example http://bitcoin.clarkmoody.com/
WebSocket Closed after 2 second.

Help ! Help ! Help !

Thanks.
speeder
Hero Member
*****
Offline Offline

Activity: 966
Merit: 501


Leading Crypto Sports Betting & Casino Platform


View Profile
September 20, 2011, 12:58:38 PM
 #103

Yay! Correct thread to complain about that!

Indeed, me too want clarkmoody on Chrome 14!

(thankfully at work Chrome is still stuck on 13)

..Stake.com..   ▄████████████████████████████████████▄
   ██ ▄▄▄▄▄▄▄▄▄▄            ▄▄▄▄▄▄▄▄▄▄ ██  ▄████▄
   ██ ▀▀▀▀▀▀▀▀▀▀ ██████████ ▀▀▀▀▀▀▀▀▀▀ ██  ██████
   ██ ██████████ ██      ██ ██████████ ██   ▀██▀
   ██ ██      ██ ██████  ██ ██      ██ ██    ██
   ██ ██████  ██ █████  ███ ██████  ██ ████▄ ██
   ██ █████  ███ ████  ████ █████  ███ ████████
   ██ ████  ████ ██████████ ████  ████ ████▀
   ██ ██████████ ▄▄▄▄▄▄▄▄▄▄ ██████████ ██
   ██            ▀▀▀▀▀▀▀▀▀▀            ██ 
   ▀█████████▀ ▄████████████▄ ▀█████████▀
  ▄▄▄▄▄▄▄▄▄▄▄▄███  ██  ██  ███▄▄▄▄▄▄▄▄▄▄▄▄
 ██████████████████████████████████████████
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
█  ▄▀▄             █▀▀█▀▄▄
█  █▀█             █  ▐  ▐▌
█       ▄██▄       █  ▌  █
█     ▄██████▄     █  ▌ ▐▌
█    ██████████    █ ▐  █
█   ▐██████████▌   █ ▐ ▐▌
█    ▀▀██████▀▀    █ ▌ █
█     ▄▄▄██▄▄▄     █ ▌▐▌
█                  █▐ █
█                  █▐▐▌
█                  █▐█
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀█
▄▄█████████▄▄
▄██▀▀▀▀█████▀▀▀▀██▄
▄█▀       ▐█▌       ▀█▄
██         ▐█▌         ██
████▄     ▄█████▄     ▄████
████████▄███████████▄████████
███▀    █████████████    ▀███
██       ███████████       ██
▀█▄       █████████       ▄█▀
▀█▄    ▄██▀▀▀▀▀▀▀██▄  ▄▄▄█▀
▀███████         ███████▀
▀█████▄       ▄█████▀
▀▀▀███▄▄▄███▀▀▀
..PLAY NOW..
bzzard
Sr. Member
****
Offline Offline

Activity: 398
Merit: 250


View Profile WWW
September 22, 2011, 11:42:50 PM
 #104

yeah, this should work?
I know that ws://mtgoxlive.com:3456/channel works Tongue

MtGox! Anyone there?

BTCCharts.com - still for free!
paraipan
In memoriam
Legendary
*
Offline Offline

Activity: 924
Merit: 1004


Firstbits: 1pirata


View Profile WWW
September 24, 2011, 05:50:28 PM
 #105

sup MagicalTux, any plans to update websockets to draft-10 any time soon ? Thanks

BTCitcoin: An Idea Worth Saving - Q&A with bitcoins on rugatu.com - Check my rep
Ente
Legendary
*
Offline Offline

Activity: 2126
Merit: 1001



View Profile
September 25, 2011, 04:28:12 PM
 #106

I was going to make a nice interface for the feed as well, but I'm not going to bother until the problems are resolved:
Rounding issues
No perfect way to start out in-sync
Alleged missing data and dark pool inconsistencies

How about these and the wss://?
Its been months that Mark didnt post here now..

And, general question:
I chose this API as a starting project to learn ruby.  Maybe a bit (too) ambitious, but would at least be a useable project, if it ever gets finished..
Are there real advantages of this "new" websocket API over the old HTTP API except that I dont have to poll any more and have instant updates (instead of every 10 secs)? I would at least not have the syncing issues?

With the probably still unsolved issues I hesitate to invest much more time into this - being a novice I still am trying to actually post to the websocket.. *rolleyes*

Thanks,

Ente
Clark
Hero Member
*****
Offline Offline

Activity: 548
Merit: 502


So much code.


View Profile WWW
October 10, 2011, 07:49:55 PM
 #107

I found the part of the draft where Chrome 14 is failing:

http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10#section-4.2

Apparently, MtGox is setting the RSV2 bit in the responses to the client. Thus, according to the spec, Chrome is required to FAIL the connection.

Using a packet sniffer, I can see the subscribed responses from the WebSocket after connecting, but the message never gets through and Chrome fails and closes the connection.

This is such a simple fix...

BkkCoins
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
October 12, 2011, 06:43:21 AM
Last edit: October 12, 2011, 12:20:58 PM by BkkCoins
 #108

Does the "own" channel work at all?

I can't figure out how to get data about my own trades/orders. I've dumped all the data streamed and there is no data not matching the default channels. I tried subscribing using a key of my own account. That doesn't work either. It seems like this just doesn't work yet.

It would be really useful to see when your own orders/trades occur. If this does work then is there a web page somewhere that says more than the one line on the wiki?

*** Edit:

Another thing I noticed now is multi-currency trades coming thru. I don't quite understand these:

19:07:57 BUY  22.81 @ $2.63192 GBP
19:07:57 BUY  22.81 @ $25.6 CNY

I see British Pounds and Chinese Yuan. But why twice and how does this work - is someone buying with Pounds and settling in Yuan or something? I realize that this must be the same trade since the  GBPCNY exchange rate is now about 10.33. Just not sure how I can handle this as info if the USD isn't indicated.

Thx.

qxzn
Hero Member
*****
Offline Offline

Activity: 609
Merit: 505



View Profile
October 12, 2011, 05:06:44 PM
 #109

I have not been able to get the "own" channel to work either. If anyone has, please share how!
Cluster2k
Legendary
*
Offline Offline

Activity: 1692
Merit: 1018



View Profile
October 16, 2011, 12:41:20 PM
Last edit: October 16, 2011, 12:54:18 PM by Cluster2k
 #110

Subscribing to my own channel doesn't work either.  I'm using VB and tried sending ANSI strings to MtGox in various formats, but as soon as I do I lose the TCP connection.  Sending the handshake right after connecting exactly the same way works fine however.

I have tried:

{'key': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'op': 'mtgox.subscribe'}
{'key': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'op': 'subscribe'}
{'op': 'mtgox.subscribe', 'key': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'}
{'op': 'subscribe', 'key': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'}

Sending nonsensical data "eg. 'testing 123' to the connection causes a disconnection as well.  Is this standard behaviour if MtGox doesn't recognise the message?

I assume the key is my key listed in my MtGox API section.  I have successfully used the key and secret to retrieve account data using a sample PHP script.

EDIT: Just tried using plain old telnet to connect to MtGox.  Works fine, just like this example:
http://dl.dropbox.com/u/24900303/screenshot/2011/04/20110415_websocket_telnet_example.png

But as soon as I try to send any subsequent data to the connection I lose it.  The wiki entry at https://en.bitcoin.it/wiki/MtGox/API is non descriptive. 

"Additionally each user has a "own" channel which streams informations about orders (new order, deleted order, etc) and trades only the user's trades). "

There is no description on how someone can subscribe to their own channel.
qxzn
Hero Member
*****
Offline Offline

Activity: 609
Merit: 505



View Profile
October 16, 2011, 05:39:19 PM
 #111

You should not be getting a disconnect just for sending an invalid message type. You should be getting a json message back that says something about how your command was unrecognized. I would double check the bytes you're sending. As a test, you can try to unsubscribe to one of the feeds. That works, so you should be able to get it to work.
Cluster2k
Legendary
*
Offline Offline

Activity: 1692
Merit: 1018



View Profile
October 16, 2011, 10:56:54 PM
Last edit: October 17, 2011, 12:20:56 AM by Cluster2k
 #112

You should not be getting a disconnect just for sending an invalid message type. You should be getting a json message back that says something about how your command was unrecognized. I would double check the bytes you're sending. As a test, you can try to unsubscribe to one of the feeds. That works, so you should be able to get it to work.

It seems I can't send anything to MtGox after the initial handshake without getting disconnected.

I've tried in telnet too (MS Windows telnet client).  Surely it should work?

telnet websocket.mtgox.com 80
Sent the following text:
GET /mtgox HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: websocket.mtgox.com
Origin: null

After pressing enter the second time I start to get the stream of data.

But when I try to send something like "{'op': 'mtgox.unsubscribe', 'key': 24e67e0d-1cad-4cc0-9e7a-f8523ef460fe}" the connection is lost.  If I send anything at all the connection dies.

I don't get it.  

EDIT: Just tried it again with Putty on Win7.  Type of connection: raw.  Same result.  I can get the streaming data, but as soon as I try to send anything back to the server on the same connection it disconnects.
qxzn
Hero Member
*****
Offline Offline

Activity: 609
Merit: 505



View Profile
October 17, 2011, 01:12:46 AM
 #113

You need to include certain bytes before and after every json message. I think no newlines. This would be hard to do in telnet. I suggest taking a hard look at this post which has haskell code that I think would still work:

https://bitcointalk.org/index.php?topic=5855.msg87198#msg87198
Cluster2k
Legendary
*
Offline Offline

Activity: 1692
Merit: 1018



View Profile
October 17, 2011, 01:26:20 AM
 #114

You need to include certain bytes before and after every json message. I think no newlines. This would be hard to do in telnet. I suggest taking a hard look at this post which has haskell code that I think would still work:

https://bitcointalk.org/index.php?topic=5855.msg87198#msg87198

Thanks for that.  I'll try putting \x00 before my message and \xFF after and see how that goes. 
Cluster2k
Legendary
*
Offline Offline

Activity: 1692
Merit: 1018



View Profile
October 17, 2011, 03:38:46 AM
 #115

You need to include certain bytes before and after every json message. I think no newlines. This would be hard to do in telnet. I suggest taking a hard look at this post which has haskell code that I think would still work:

https://bitcointalk.org/index.php?topic=5855.msg87198#msg87198

That works fine.  I wasn't sending the \x00 and \xFF at the beginning and end of each message.

I can successfully unsubscribe from the depth feed using:
{"channel":"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe","op":"unsubscribe"}

However when I try to resubscribe I get the following error:
{"message":"Unknown command","op":"remark","success":false}

I have tried all sorts of combinations of subscribe messages, but none seems to work.  I also can't subscribe to my own channel.

The following all fail:
{"channel":"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe","op":"subscribe"}
{"channel":"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe","op":"mtgox.subscribe"}
{"op":"subscribe","channel":"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe"}
{"op":"mtgox.subscribe","channel":"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe"}
{"op":"subscribe","24e67e0d-1cad-4cc0-9e7a-f8523ef460fe"}
{"op":"mtgox.subscribe","24e67e0d-1cad-4cc0-9e7a-f8523ef460fe"}

I looked at the haskell code and tried that subscription message first, then tried various other combinations.

hPutFrame h $ "{\"op\":\"mtgox.subscribe\"," ++ key ++ "}"
Cluster2k
Legendary
*
Offline Offline

Activity: 1692
Merit: 1018



View Profile
October 17, 2011, 07:33:09 AM
 #116

I have just been informed on #mtgox IRC that websockets are read-only.  Have been for a number of weeks.  Subscriptions don't work and it's not possible to view your own executed trades.

It's possible get around this limitation, but it really makes the system slow and a bit cumbersome to use.  It would be so much more convenient to get instant confirmation of your own trades.
Clark
Hero Member
*****
Offline Offline

Activity: 548
Merit: 502


So much code.


View Profile WWW
October 20, 2011, 04:12:46 PM
 #117

I would like to see depth messages for all of the currencies broadcast out over the WebSocket, as I do not think it's happening right now.

Can anyone confirm that there are only USD depth messages coming across the socket?

molecular
Donator
Legendary
*
Offline Offline

Activity: 2772
Merit: 1019



View Profile
October 21, 2011, 01:23:06 PM
 #118

I would like to see depth messages for all of the currencies broadcast out over the WebSocket, as I do not think it's happening right now.

Can anyone confirm that there are only USD depth messages coming across the socket?

Looks like it's true. I am filtering for "depth_msg['currency'] == 'USD'", but put a debug log line for the other case. It doesn't trigger.

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

Activity: 2126
Merit: 1001



View Profile
October 26, 2011, 03:29:34 PM
 #119

I am having problems with Websockets and Ruby in general, maybe someone of you is kind enough to help out?
I am beginner with Ruby and chose this as a learning-by-doing project.

Using examples from the web, I am still trying to connect to the websocket (works) and sending strings to it (handshake and channel subscription/exiting):

Code:
require 'rubygems' 'eventmachine' 'em-http-request'
 
EventMachine.run {
  verbindung = EventMachine::HttpRequest.new("http://websocket.mtgox.com").get :timeout => 0

  verbindung.errback { puts "oops" }
  verbindung.callback   {
    puts "WebSocket connected!"
                 
verbindung.send("GET /mtgox HTTP/1.1\n", 0)
  }
}

Error, my Ruby doesnt recognize "GET /mtgox HTTP/1.1\n" as a string to be "send" :

Code:
websocket.rb:19:in `send': undefined method `GET /mtgox HTTP/1.1 (NoMethodError)
' for #<EventMachine::HttpClient:0x7f9f6d22e8b8>

I tried "print", "send", "write", "<<", still didnt get it to work. I am lost, grateful for any hint!

Ente
runeks
Legendary
*
Offline Offline

Activity: 980
Merit: 1008



View Profile WWW
October 28, 2011, 09:13:22 PM
 #120

Anyone else getting timeouts connecting to ws://websocket.mtgox.com/mtgox? I am right now...
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!