Using magic-wormhole library interface #4

Open
opened 4 years ago by decentral1se · 3 comments
Owner

We're currently using the command-line interface but that will prove difficult to manage when distributing, so we would ideally understand how the heck to use magic-wormhole API. This might need some nudging on the magic-wormhole IRC channel or somewhere we can find people who can help us do this.

We're currently using the command-line interface but that will prove difficult to manage when distributing, so we would ideally understand how the heck to use magic-wormhole API. This might need some nudging on the magic-wormhole IRC channel or somewhere we can find people who can help us do this.
decentral1se self-assigned this 4 years ago
Poster
Owner

I nagged again on the #magic-wormhole IRC channel but no response. I suspect the main developer is not present there. I will open a ticket on the repository and ask if they know how to mix the Twisted / Gtk / Trio event loop madness and still use the library. Could be a mess lol...

Also, found a simple example from their docs:

https://magic-wormhole.readthedocs.io/en/latest/api.html

import wormhole
from twisted.internet.defer import inlineCallbacks

@inlineCallbacks
def go():
    w = wormhole.create(appid, relay_url, reactor)
    w.allocate_code()
    code = yield w.get_code()
    print "code:", code
    w.send_message(b"outbound data")
    inbound = yield w.get_message()
    yield w.close()

I nagged again on the `#magic-wormhole` IRC channel but no response. I suspect the main developer is not present there. I will open a ticket on the repository and ask if they know how to mix the Twisted / Gtk / Trio event loop madness and still use the library. Could be a mess lol... Also, found a simple example from their docs: > https://magic-wormhole.readthedocs.io/en/latest/api.html ```python import wormhole from twisted.internet.defer import inlineCallbacks @inlineCallbacks def go(): w = wormhole.create(appid, relay_url, reactor) w.allocate_code() code = yield w.get_code() print "code:", code w.send_message(b"outbound data") inbound = yield w.get_message() yield w.close() ```
Poster
Owner
Welll, I gave it a shot: > https://github.com/warner/magic-wormhole/issues/400
Poster
Owner

Trio hackers seem to think this is possible:

yeah, in theory you could use https://twistedmatrix.com/documents/current/api/twisted.internet.asyncioreactor.html + trio-asyncio to run arbitrary twisted code on trio

Soooo, dunno, maybe easier to just learn how to run twisted stuff on its own and then figure out how to make that work with gtk rather than try to pipe it down all the layers. Will need some investigation.

Trio hackers seem to think this is possible: > yeah, in theory you could use https://twistedmatrix.com/documents/current/api/twisted.internet.asyncioreactor.html + trio-asyncio to run arbitrary twisted code on trio Soooo, dunno, maybe easier to just learn how to run twisted stuff on its own and then figure out how to make that work with gtk rather than try to pipe it down all the layers. Will need some investigation.
decentral1se removed their assignment 3 years ago
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.