> ## Documentation Index
> Fetch the complete documentation index at: https://gb.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Websocket API

> The Websocket connection should be used for applications that require a live subscription to data, this connection type flows data to the screen automatically and tends to consume more messages as a result.The MLink Websocket API is implemented as a standard HTTP WebSocket service accessible at:

* **Real-time Data:** `wss://mlink-live.nms.saturn.spiderrockconnect.com`
* **Delayed Data:** `wss://mlink-delay.nms.saturn.spiderrockconnect.com`

Query parameters are URL-encoded and passed in the querystring. If successful, responses are sent back via the HTTP request body section. The URL also determines the protocol.

# These are the lists of WebSockets that come with the product:

## 1- MLinkStream:

a. StockBookQuote (Stock quote stream for ticker AAPL) – can change where clause in the message bodies to change ticker

```
{
            "header": {
                "mTyp": "MLinkStream"
            },
            "message": {
                "queryLabel": "StockBookQuoteTest",
                "activeLatency": 0,
                "msgName": "StockBookQuote", 
                "where": "ticker.tk:eq:AAPL"
            }
        }
```

b. OptionNbboQuote (Option Quote stream for AAPL Options) – can change where clause in the message body to change option ticker

```
{
            "header": {
                "mTyp": "MLinkStream"
            },
            "message": {
                "queryLabel": "OptionNbboQuoteTest",
                "activeLatency": 1,
                "msgName": "OptionNbboQuote", 
                "where": "okey.tk:eq:AAPL"
            }
        }
```

## 2- MLinkSubscribe

a. MLinkSubscribe to specific stock quotes (10 tickers)

```
{
    "header": {
        "mTyp": "MLinkSubscribe"
    },
    "message": {
        "activeLatency": 10000,
        "doReset": "No",
        "View": [
            {
                "msgName": "StockBookQuote",
                "view": "updateType|askPrice1|askSize1|bidPrice1|bidSize1"
            }
        ],
        "Subscribe": [
            {
                "msgName": "StockBookQuote",
                "msgPKey": "AAPL-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "MRNA-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "TSLA-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "SPY-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "MSFT-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "JPM-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "QQQ-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "ROKU-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "AMZN-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "META-NMS-EQT"
            }
        ]
    }
}
```

b. MLinkSubscribe (unsubscribe) to 7 of those tickers in the type of message (stock quotes)

```
{
    "header": {
        "mTyp": "MLinkSubscribe"
    },
    "message": {
        "activeLatency": 10000,
        "doReset": "No",
        "View": [
            {
                "msgName": "StockBookQuote",
                "view": "updateType|askPrice1|askSize1|bidPrice1|bidSize1"
            }
        ],
        "Unsubscribe": [
            {
                "msgName": "StockBookQuote",
                "msgPKey": "AAPL-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "MSFT-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "JPM-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "QQQ-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "ROKU-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "AMZN-NMS-EQT"
            },
            {
                "msgName": "StockBookQuote",
                "msgPKey": "META-NMS-EQT"
            }
        ]
    }
}
```

## 3- MLinkStream + SignalReady

a. MLinkStream + ActiveLatency of 0 for liveimpliedquotes (SpiderRock quotes + greeks + vols) to allow for signalReady to be sent in order for client end to receive data again (allows to fetch on demand) – Ticker is SPY (ALL SPY options)

```
{
    "header": {
        "mTyp": "MLinkStream"
    },
    "message": {
        "queryLabel": "LiveImpliedQuoteTest",
        "activeLatency": 0,
        "msgName": "LiveImpliedQuote", 
        "where": "ticker.tk:eq:SPY"
    }
}
```

b. SignalReady message to send when client is ready to receive new updates.

```
{
    "header": {
        "mTyp": "MLinkSignalReady"
    },
    "message": {
        "readyScan": "FullScan" 
    }
}
```
