- Notifications
You must be signed in to change notification settings - Fork17
Description
Hello,
Currently, themessage_handler
callback function only receives the Threema message object as an argument at thee2e.add_callback_route
function when the web route is triggered. That works great for simple one-way communication. But when you try to send a replay to a user via Threema Gateway, it gets problematic because you can’t create a second Connection Instance. After all, the aiohttp web service is already using one, and the Connection implementation will raise an error if you create a second instance without the first being closed.
A possible solution would be to forward the Connection Instance as an additional argument to themessage_handler
callback function to make it accessible. Then, it can be used to interact with the Threema Gateway from the function without needing to open a second Connection Instance.
The message object that is currently passed as an argument to the function can’t be used to access the Connection Instance because it only contains it as a private_connection
object