# 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="https://2064370003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtfYqJbPehJwim2mkXF60%2Fuploads%2FsZkesWFQvwqOi3Hpemtr%2Fimage.png?alt=media&#x26;token=67cdd50a-053a-4b64-9754-34b634c78838" 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 %}
