Skip to content
Discussion options

You must be logged in to vote

Yeah, thats the case. There's also nothing in the library that generates a thread or an event loop I can see, so you have to do that yourself I think. The tests run with asyncio.run() which creates a loop and then closes it after the async calls have finished.

If other people want to get it running, I think you want to do something like this:

class JSSyncToAsync:
    nats_servers: list[str]
    loop: AbstractEventLoop

    def set_loop_and_connect(self: Self):
        self.loop = asyncio.new_event_loop()
        asyncio.set_event_loop(self.loop)
        self.added_topics = set()

        Thread(target=self.run_client, daemon=True).start()

        asyncio.run_coroutine_threadsafe(self.con…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by benjfield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
defect Suspected defect such as a bug or regression
2 participants
Converted from issue

This discussion was converted from issue #724 on October 14, 2025 16:20.