Websocket Connection

A Detail About Matscan Websocket Server.

WebSocket Connection Details

PropertyDetails
WebSocket URLwss://matscan.xyz
Event Namenew_transactions

Prerequisites

  • A Socket.IO-compatible WebSocket client (e.g., socket.io-client for JavaScript).
  • A stable internet connection.

Connecting to the WebSocket

To receive transaction updates:

  1. Connect to wss://matscan.xyz.
  2. Listen for the new_transactions event.

Example: JavaScript with Socket.IO

import { io } from "socket.io-client";

const socket = io("wss://matscan.xyz", {
  transports: ["websocket"],
  reconnection: true,
});

socket.on("connect", () => {
  console.log("Connected to Matscan WebSocket");
});

socket.on("new_transactions", (data) => {
  console.log("New Transaction:", data);
});

socket.on("connect_error", (error) => {
  console.error("Connection Error:", error.message);
});

socket.on("disconnect", () => {
  console.log("Disconnected from Matscan WebSocket");
});

Installation

npm install socket.io-client

Event Data Format

The new_transactions event emits a JSON object with transaction details.

Example Payload

{
  "title": "Claimed Points",
  "timestamp": 1746464733649,
  "amount": "100",
  "sender": "matscan",
  "receiver": "system",
  "txid": "6818efdd27fa98ffac699055"
}

Field Descriptions

FieldTypeDescription
titleStringTransaction type (e.g., "Claimed Points").
timestampNumberUnix timestamp (milliseconds).
amountStringTransaction amount (e.g., "100").
senderStringDiscord username or "system" if from a bot.
receiverStringDiscord username or "system" if from a bot.
txidStringUnique transaction ID.