Permalink
Browse files

show the channel name

  • Loading branch information...
1 parent 24d79ec commit 5cb46192ed767d88e9bdb39b120e87344962c25b cronopio committed Sep 14, 2011
Showing with 14 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +13 −2 bin/ws
View
@@ -1,2 +1,3 @@
gmon.out
node_modules/
+.project
View
15 bin/ws
@@ -8,12 +8,23 @@ var mtgoxTest = new WebSocketHook({
debug:true
});
+var mtgoxChannels = [
+ {key:'dbf1dee9-4f2e-4a08-8cb7-748919a71b21', name:'Trades', private:'trade'},
+ {key:'d5f06780-30a8-4a48-a2f8-7ed181b4a13f', name:'MtGox Tick', private: 'ticker'},
+ {key:'24e67e0d-1cad-4cc0-9e7a-f8523ef460fe', name:'All Market', private:'depth'}
+];
+
mtgoxTest.on('websocket::message',function(data){
if (data.op == 'subscribe'){
- console.log('Now suscribe to '+data.channel);
+ var channel = (mtgoxChannels.filter(function(c){
+ if (c.key == data.channel)
+ return true;
+ else
+ return false;
+ }).pop());
+ console.log('Now suscribe to '+channel.name);
}
- console.log(data);
});
mtgoxTest.start();

0 comments on commit 5cb4619

Please sign in to comment.