How Are the Request Calculated If I Connect the Web Socket With Subscribe?
Hello. This is Klaytn API Service team.
Please refer to the following information about the calculation approach of request numbers.
Before getting into the actual answer, let’s take a brief look at the concepts of WebSocket and subscription mentioned in the inquiry.
A web socket is a computer communication protocol that provides a two-way communication channel. If you are following the STOMP protocol, you are also using the pub/sub structure, where all subscribers receive the messages published to a topic right away. In order to be subscribed, use the subscribe command to be open to sending requests and receiving responses.
In general, the subscription method only requires a request in the case of a connection.
However, keep in mind that since there is a timeout of about a minute, you need to periodically generate a request that receives block numbers and such before the timeout occurs.
When testing, requests are mostly done once every 50 seconds. Because one day is 60 seconds * 60 minutes * 24 hours = 86,400 seconds, dividing it into 50 seconds makes it equal to 1728 requests. After considering the different variables (such as reconnection), the total number of requests generated will be around 2000.
For any additional questions, you may select Inquiry Registration above the KAS Help Center where you can register your inquiry.
Thank you.
Klaytn API Service team.