zyc
zyc
CDCloudflare Developers
Created by zyc on 7/16/2024 in #workers-help
How to avoid cancel from client disconnection?
I’m trying to build a serverless chatbot for lark. Lark is an IM app like WhatApp. When someone sends a message to the bot account, it will send a POST request to an URL. I’m using worker as an intermediary to send the message to ChatGPT, and then send another POST request to send the reply to the chat. This should be two separate actions, but I’m currently putting the second into the first one to make them one worker. However, since the call of ChatGPT can take some time to response, lark may close the connection, and kills everything. Can I ask if it’s possible to return a response to make lark happy, and then run everything in background? Or is it possible to use two workers in RPC? Thank you!
4 replies