Websocket API: Uknown mtgox message type Here's a bit of node.js code:



var WebSocket = require('ws');
var ws = new WebSocket('ws://websocket.mtgox.com:80/mtgox?Currency=USD');
ws.on('open', function() {
    console.log('Connection opened');
    ws.send(JSON.stringify({ "op": "mtgox.subscribe", "type": "depth.BTCUSD" }));
});
ws.on('message', function(message) { console.log(message); });


When this client sends {"op": "mtgox.subscribe", "type": "depth.BTCUSD" } the API returns {"message":"Unknown mtgox message type","op":"remark","success":false}.

What am I doing wrong?
try using socket.io-client 

var io = require('socket.io-client');


then its as simple as 

var socket = io.connect( 'https://socketio.mtgox.com/mtgox' );


and then to subscribe to a specific channel 

var message = {
  "op": "subscribe",
  "channel": "24e67e0d-1cad-4cc0-9e7a-f8523ef460fe" // this is the market depth channel
};

socket.send(JSON.stringify(message));

socket.on('message', function(message) { console.log(message); });


should give you the results your looking for

I think your main problem is that your not using the channel id's in your connection message. Here is the Mtgox web sockets api which has a list of all the different channel id's. And heres a project which implements them generically. 

Hope this helps