# Websocket Feeds

The Instamint websocket allows STOMP clients to subscribe to feeds that provide notification of events. The websocket is accessible via [http://ws.instamint.network](http://ws.instamint.network/) subscribe to **/feed/kafka**.&#x20;

> Please note that websocket channel names are subject to change

Currently the events that are supported include:

<table><thead><tr><th width="213">Event</th><th>Fires when..</th></tr></thead><tbody><tr><td>Mint</td><td>An asset is attempted to minted, when minting is successful or fails</td></tr><tr><td>Auction</td><td>An auction is created, closed or when a bid arrives or ask is adjusted</td></tr><tr><td>Trade</td><td>An asset is sold at an auction</td></tr><tr><td>Transfer</td><td>An asset is transferred</td></tr></tbody></table>

<figure><img src="/files/muzPb1PXHSXiHQvgbfEK" alt=""><figcaption><p>Websocket messages confirming minting and creation of an auction</p></figcaption></figure>

The below Python code establishes a STOMP-based websocket client that listens to events and prints them to the terminal

{% code overflow="wrap" lineNumbers="true" %}

```python
import websocket
import stomper
import time
from threading import Thread

class Client:
    def connect(self):
        self.ws = websocket.WebSocketApp("ws://ws.instamint.network/ws",
                    on_message = self.on_msg,
                    on_error   = self.on_error,
                    on_close   = self.on_closed,
                    on_open    = self.on_open)
        self.ws.run_forever()

    def on_open(self, ws):
        self.ws.send("CONNECT\naccept-version:1.0,1.1,2.0\n\n\x00\n")
        self.ws.send(stomper.subscribe("/feeds/kafka", "sub3", ack="auto"))
        

    def on_msg(self, ws, msg):
        frame = stomper.Frame()
        unpacked_msg = stomper.Frame.unpack(frame, msg)
        print("Received the message: " + str(unpacked_msg['body']))

    def on_closed(self, ws):
        print("The websocket connection is closed.")

    def on_error(self, ws, err):
        print(err)

    def send(self, feed, msg):
        f = stomper.Frame()
        f.unpack(stomper.send(feed, msg))
        frame = f.pack()
        self.ws.send(frame)

client = Client()
thread = Thread(target=client.connect, daemon=True)
thread.start()
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scifn.com/instamint/websocket-feeds.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
