Webhooks
What is webhooks?
Webhooks are a method of real-time communication between web applications. They are automated messages or notifications sent from one system to another when a specific event occurs. Essentially, webhooks allow one application to notify another of events that trigger an immediate action or response.
Webhooks are preferred over continuous polling for the following reasons:
Real-time updates: Webhooks provide real-time updates. When an event occurs, a webhook immediately triggers an action in the receiving application. This is different from polling, which repeatedly checks for updates at predefined intervals.
Efficiency: Polling is inefficient, especially if there are no updates. It requires periodic API requests even if there is no new data. in contrast, webhooks are event-driven, which means they only send data when an event occurs, reducing unnecessary traffic and server load.
Less Latency: Webhooks minimize latency. Because Webhooks send updates in real-time, you can get the latest data as soon as it becomes available. With polling, you may experience delays depending on the frequency of polling.
Simple: Setting up a webhook requires configuration of the source application to send data to a specified endpoint. Polling, on the other hand, is more complex as it requires writing and maintaining code to periodically query the API.
Simply put, webhooks in Web3 games provide a mechanism for real-time communication and data synchronization, making the gaming experience more dynamic and engaging, while also improving the operational efficiency of blockchain-based games.
What can webhooks offer?
In Web3 games, webhooks can serve a variety of purposes to enhance the gameplay experience and simplify operations. Common use cases are listed below:
Real-time game events: Webhooks are a powerful tool for sending real-time notifications to players, game servers, or other applications whenever an event related to an on-chain asset requested by a partner occurs. For example, if certain events depend on the minting, transferring, burning, or updating of an asset's metadata; webhooks are an efficient way for partner applications to receive alerts when these events occur.
Marketplace Updates: Webhooks allow third-party marketplaces to know the status of in-game assets listed on multiple platforms. They receive instant updates when items are listed or sold elsewhere, ensuring accurate inventory management for traders and collectors.
Analytics and Metrics: Webhooks sends game-related data to an analytics platform, enabling game developers to track player behavior, identify trends, and make decisions to improve the game based on the data.
Synchronized Databases: With Webhooks, third parties can keep a local copy of the GMLayer Blockchain Data API database. External databases can be mapped to GMLayer's records by receiving notifications when an event occurs that changes the state of an asset, token, or collection.
Event Subscription
The events below can be requested through a single Webhook connection:
Activity Group | Type | Node |
---|---|---|
Activity |
| This activity provides details of minted coins (NFT (Non-Fungible Token)), transfers (NFT (Non-Fungible Token)), burned coins (NFT (Non-Fungible Token)), transactions (NFT (Non-Fungible Token)), withdrawals (ERC20) and deposits (ERC20) on the GMLayer'zkEVM blockchain. These activity are great for tracking NFT (Non-Fungible Token) ownership changes, as well as monitoring blockchain activity to trigger application updates. No metadata is included in these event types. |
Collection |
| The activity is signaled when a collection is created or modified. The payload of these events contains the metadata of the collection. |
NFT (Non-Fungible Token) |
| This activity signals when an NFT (Non-Fungible Token) is created or modified. It consists of a |
Metadata |
| This activity provides detailed information about the properties of metadata stacks, each of which is identified by a unique |
Token |
| This activity is signaled when a new ERC20 token is deployed on GMLayer's zkEVM platform. |
Order |
| This event signals when a new order (list) appears on a third-party marketplace. Orders are processed centrally through GMLayer's central order book. |
Trade |
| This event signals when a transaction occurs on the GMLayerGlobalOrderbook. The details of the transaction (including additional fees) are displayed. |
Last updated