Using magic-wormhole library interface #4

Open
opened 2020-10-07 18:01:23 +02:00 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 2020-10-07 18:01:37 +02:00
Author
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() ```
Author
Owner
Welll, I gave it a shot: > https://github.com/warner/magic-wormhole/issues/400
Author
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 2021-01-18 13:37:51 +01:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: rra/dropship#4
No description provided.