<h1>MtGox PubNub API and Websockets API</h1>

<p>The two endpoints you are describing are indeed two separate endpoints which you will use under certain conditions depending on what you are seeking.  The Public stream feeds and more can be accessed by issuing a <code>.subscribe()</code> PubNub SDK instance method call from the PubNub Class. For now the MtGox WS API is in deprecation and recommended that you upgrade using a standard MIT open source PubNub SDK which you can find your language here: <a href="http://www.pubnub.com/developers/" rel="nofollow">http://www.pubnub.com/developers/</a></p>

<p>For receiving data via PubNub Real-Time Network you can use an SDK like JavaScript to receive real-time trade events.</p>

<h2>Mt.Gox Data Feed Stream:</h2>

<pre><code>&lt;script src="https://cdn.pubnub.com/pubnub.min.js"&gt;&lt;/script&gt;
&lt;script&gt;(function(){

// INITIALIZE PUBNUB
var pubnub = PUBNUB.init({
    subscribe_key : 'sub-c-50d56e1e-2fd9-11e3-a041-02ee2ddab7fe'
});

// MULTIPLEX SUBSCRIBE TO TICKER FEED AND ALSO TRADES FEED
pubnub.subscribe({
    backfill : true,
    channel  : [
        'd5f06780-30a8-4a48-a2f8-7ed181b4a13f', // TICKER
        'dbf1dee9-4f2e-4a08-8cb7-748919a71b21'  // TRADE (BUY/SELL)
    ],
    message  : function(message) {
        // FIRE EVENT WHEN DATA ARRIVES
        console.log( message.channel_name, message );
    }
});

})();&lt;/script&gt;
</code></pre>

CC BY-SA 3.0
2013-12-26T20:25:12.057Z
So MtGox WS api connection is going to be deprecated soon and normally new software should use pubnub connection only? Are the api features the same?
Anri
CC BY-SA 3.0
2014-01-03T22:41:14.963Z
For public streams and otherwise, you'll read the data flow from PubNub.  However for purchasing and selling (actually trading) you'll issue those commands via Mt.Gox purchasing API directly.
Stephen Blum
CC BY-SA 3.0
2013-12-26T19:59:56.680Z
2013-12-26T20:06:34.593Z
2013-12-26T20:06:34.593Z
Stephen Blum
<p>On their wiki MtGox have pages for Pubnub API and Websocket API.
So when I connect to Websocket API - it just goes through Pubnub, or it's a different way to connect?</p>

<mtgox><api><pubnub>
Is MtGox Pubnub API and Websocket API the same thing?
Anri
# Is MtGox Pubnub API and Websocket API the same thing?

(Asked by: username_0 on 2013-12-24)

On their wiki MtGox have pages for Pubnub API and Websocket API.
So when I connect to Websocket API - it just goes through Pubnub, or it's a different way to connect?

**Tags:** mtgox, api, pubnub


---

## 1 answers

### Answer by username_1 on 2013-12-26. Score: 3 | Accepted answer

# MtGox PubNub API and Websockets API

The two endpoints you are describing are indeed two separate endpoints which you will use under certain conditions depending on what you are seeking. The Public stream feeds and more can be accessed by issuing a `.subscribe()` PubNub SDK instance method call from the PubNub Class. For now the MtGox WS API is in deprecation and recommended that you upgrade using a standard MIT open source PubNub SDK which you can find your language here: <http://www.pubnub.com/developers/>

For receiving data via PubNub Real-Time Network you can use an SDK like JavaScript to receive real-time trade events.

## Mt.Gox Data Feed Stream:

```
<script src="https://cdn.pubnub.com/pubnub.min.js"></script>
<script>(function(){

// INITIALIZE PUBNUB
var pubnub = PUBNUB.init({
    subscribe_key : 'sub-c-50d56e1e-2fd9-11e3-a041-02ee2ddab7fe'
});

// MULTIPLEX SUBSCRIBE TO TICKER FEED AND ALSO TRADES FEED
pubnub.subscribe({
    backfill : true,
    channel  : [
        'd5f06780-30a8-4a48-a2f8-7ed181b4a13f', // TICKER
        'dbf1dee9-4f2e-4a08-8cb7-748919a71b21'  // TRADE (BUY/SELL)
    ],
    message  : function(message) {
        // FIRE EVENT WHEN DATA ARRIVES
        console.log( message.channel_name, message );
    }
});

})();</script>

```

> **Comments:**
> **username_0**: So MtGox WS api connection is going to be deprecated soon and normally new software should use pubnub connection only? Are the api features the same?  
> **username_1**: For public streams and otherwise, you'll read the data flow from PubNub.  However for purchasing and selling (actually trading) you'll issue those commands via Mt.Gox purchasing API directly.  

---

