In Node-red how to close tcp session

Using node-red I am integrating teltonika GPS device(Teltonika Data Sending Protocols - Wiki Knowledge Base | Teltonika GPS). In node-red I am receiving data through tcp listener node . Whenever the device creates connection it will first send imei number and I am storing that in redis like sessionid:imei number(session id as key and imei as value). So, I need to send reply packet for acceptance of connection like 1 or 0. If accepted device will send the gps tracking data based on the sessionid I am fetching imei from redis and enriching the data with imei number and pushing to the next processing layer.

But while storing redis I am storing with key expiry. So, each time whenever I am listening data I am updating expiry for the session key. So, if teltonica device is not sending the data for 2 hour I am deleting the key from redis. So, how can I terminate the session from node-red on redis expiry or is any other better approach which I can follow.