Closed HeapUnderfl0w closed 6 years ago
Thanks for the question! Probably the most important part is to know that IrcClient
is cheap to clone ([doc pointer]). So, while you do need to give a copy to register_client_with_handler
, you can clone a copy for yourself. Once you have a separate copy, the question of how to set up message sending is somewhat dependent on the input source, but as an example, you might have a channel where the receiving half just sends whatever it receives to the client.
Ah, i just assumed that cloning the client itself would create some problems with the actual underlying connection.
I will try that out and update this issue after that.
Works as intended, thank you very much.
Fantastic! Cheers! 🍻
I currently have the situation where i do not use the crate for a bot, but instead as a back-end for a user facing UI. At the moment i get information OUT of the event system by just stuffing a
mpsc::Sender
into the function and output over that.But this does not work if i want to send messages over the client connection, as the client itself is consumed by the register function.
Is there any approach i am missing, which i could use to pass messages to the client (which in turns sends them) ?