Bitcoin Forum
June 24, 2024, 10:26:39 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Mtgox stremaing API doesn't work (for me)  (Read 603 times)
squigly (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
May 01, 2013, 08:11:43 AM
 #1

I'm trying to read market data off their streaming API.
I fail in the initial connection setup,

This is what I send through the socket:

GET /mtgox/Currency=USD HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: websocket.mtgox.com:80
Origin: websocket.mtgox.com:80
Sec-WebSocket-Key: UWaphFPiSqq3f2gOmaD5Sg==
Sec-WebSocket-Version: 13

and I get back HTTP/1.1 400 Bad Request, Always, no matter what I do.

Any Idea?
kokjo
Legendary
*
Offline Offline

Activity: 1050
Merit: 1000

You are WRONG!


View Profile
May 01, 2013, 08:16:14 AM
 #2

stuff works fine for me when i copypaste

"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
kokjo
Legendary
*
Offline Offline

Activity: 1050
Merit: 1000

You are WRONG!


View Profile
May 01, 2013, 08:16:48 AM
 #3

Code:
GET /mtgox/Currency=USD HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: websocket.mtgox.com:80
Origin: websocket.mtgox.com:80
Sec-WebSocket-Key: UWaphFPiSqq3f2gOmaD5Sg==
Sec-WebSocket-Version: 13

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: Bzz8qKJPEMNNOgC4hOZd3iZNb5o=

�4{"message":"Now online (no channels)","op":"remark"}

�


"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
squigly (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
May 01, 2013, 08:23:27 AM
 #4

I've copied your text from the code snipplet, put it on a telnet window going to websocket.mtgox.com:80
and this is what I get:

GET /mtgox/Currency=USD HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: websocket.mtgox.com:80
Origin: websocket.mtgox.com:80
Sec-WebSocket-Key: UWaphFPiSqq3f2gOmaD5Sg==
Sec-WebSocket-Version: 13


HTTP/1.1 400 Bad Request

For the love of everything fuzzy small and furry, I can't understand what the eff is going on...






squigly (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
May 01, 2013, 08:42:57 AM
 #5

Ok, here's a strange bit:
When pasting the HTTP request to a telnet on a WINDOWS box, it fails.
When pasting the HTTP request to a telnet on a LINUX box, it passes.

(The code I wrote (that failed) was in C# on windows)

wtf?
TheRealSteve
Hero Member
*****
Offline Offline

Activity: 686
Merit: 500

FUN > ROI


View Profile
May 01, 2013, 08:49:09 AM
 #6

install a sniffer (e.g. wireshark) and check if what you think you're sending is what you're actually sending?

kokjo
Legendary
*
Offline Offline

Activity: 1050
Merit: 1000

You are WRONG!


View Profile
May 01, 2013, 08:53:16 AM
 #7

Ok, here's a strange bit:
When pasting the HTTP request to a telnet on a WINDOWS box, it fails.
When pasting the HTTP request to a telnet on a LINUX box, it passes.

(The code I wrote (that failed) was in C# on windows)

wtf?
some stuff about line endings... \n  vs.  \r\n

"The whole problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts." -Bertrand Russell
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!