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 subscribe to /feed/kafka.
Please note that websocket channel names are subject to change
Currently the events that are supported include:
Event
Fires when..
Mint
An asset is attempted to minted, when minting is successful or fails
Auction
An auction is created, closed or when a bid arrives or ask is adjusted
Trade
An asset is sold at an auction
Transfer
An asset is transferred

The below Python code establishes a STOMP-based websocket client that listens to events and prints them to the terminal
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()
Last updated