You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are cases when a request packet is sent and then a response is received in another packet. When doing that, you must keep several things in mind:
keep the ReqI of the request packet in sync with the check in the reply packet event listener
make sure the ReqI is unique so the listener will only handle the correct request and not a different one
Example:
constREQUEST_ID=255;this.send(newIS_TINY({ReqI: REQUEST_ID,SubT: TinyType.TINY_GTH,}),);this.once(PacketType.ISP_SMALL,(packet)=>{if(packet.ReqI===REQUEST_ID&&packet.SubT===SmallType.SMALL_RTP){// Do something with packet.UVal}});
Solution
Create new public async methods in the InSim class.
As suggested in #51 (comment)
Problem
There are cases when a request packet is sent and then a response is received in another packet. When doing that, you must keep several things in mind:
ReqI
of the request packet in sync with the check in the reply packet event listenerReqI
is unique so the listener will only handle the correct request and not a different oneExample:
Solution
Create new public async methods in the InSim class.
Example usage:
Requirements
The
ReqI
must be unique in such a way that if multiple requests are sent at the same time, they both get resolved independently.Requests
IS_TINY
SubT:
TinyType.TINY_PING
IS_TINY
SubT:
TinyType.TINY_REPLY
IS_TINY
SubT:
TinyType.TINY_GTH
IS_SMALL
SubT:
SmallType.SMALL_RTP
The text was updated successfully, but these errors were encountered: