Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connection argument to the message_handler callback on the e2e.add_callback_route function #70

Open
nisutec opened this issue Sep 8, 2024 · 0 comments

Comments

@nisutec
Copy link

nisutec commented Sep 8, 2024

Hello,

Currently, the message_handler callback function only receives the Threema message object as an argument at the e2e.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 the message_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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant