mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 07:16:31 +03:00
seems to work
This commit is contained in:
@@ -48,28 +48,26 @@ def test_basic_iroh_jsonrpc(acfactory, path_to_webxdc):
|
|||||||
# send iroh announcements
|
# send iroh announcements
|
||||||
log("sending ac1 -> ac2 realtime advertisement")
|
log("sending ac1 -> ac2 realtime advertisement")
|
||||||
ac1._rpc.send_webxdc_realtime_advertisement(ac1.id, ac1_webxdc_msg.id)
|
ac1._rpc.send_webxdc_realtime_advertisement(ac1.id, ac1_webxdc_msg.id)
|
||||||
|
log("sending additinal messdage ac1 -> ac2")
|
||||||
acfactory.send_message(from_account=ac1, to_account=ac2, text="ping1")
|
acfactory.send_message(from_account=ac1, to_account=ac2, text="ping1")
|
||||||
log("sending ac2 -> ac1 realtime advertisement")
|
log("sending ac2 -> ac1 realtime advertisement")
|
||||||
ac2._rpc.send_webxdc_realtime_advertisement(ac2.id, ac2_webxdc_msg.id)
|
ac2._rpc.send_webxdc_realtime_advertisement(ac2.id, ac2_webxdc_msg.id)
|
||||||
|
log("sending additinal messdage ac2 -> ac1")
|
||||||
acfactory.send_message(from_account=ac2, to_account=ac1, text="ping2")
|
acfactory.send_message(from_account=ac2, to_account=ac1, text="ping2")
|
||||||
|
log("waiting for incoming message on ac2")
|
||||||
snapshot = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
snapshot = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
||||||
assert snapshot.text == "ping1"
|
assert snapshot.text == "ping1"
|
||||||
|
log("waiting for incoming message on ac1")
|
||||||
snapshot = ac1.get_message_by_id(ac1.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
snapshot = ac1.get_message_by_id(ac1.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
||||||
assert snapshot.text == "ping2"
|
assert snapshot.text == "ping2"
|
||||||
|
|
||||||
# send realtime data
|
|
||||||
for i in range(2):
|
|
||||||
print("sleeping waiting")
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
log("sending realtime data ac1 -> ac2")
|
log("sending realtime data ac1 -> ac2")
|
||||||
ac1._rpc.send_webxdc_realtime_data(ac1.id, ac1_webxdc_msg.id, [13, 15, 17])
|
ac1._rpc.send_webxdc_realtime_data(ac1.id, ac1_webxdc_msg.id, [13, 15, 17])
|
||||||
log("ac2: waiting for realtime data")
|
log("ac2: waiting for realtime data")
|
||||||
while 1:
|
while 1:
|
||||||
event = ac2.wait_for_event()
|
event = ac2.wait_for_event()
|
||||||
if event.kind == EventType.WEBXDC_REALTIME_DATA:
|
if event.kind == EventType.WEBXDC_REALTIME_DATA:
|
||||||
assert 0
|
assert event.data == [13, 15, 17]
|
||||||
else:
|
break
|
||||||
log(f"ignoring {event.kind}")
|
#else:
|
||||||
|
# log(f"ignoring {event.kind}")
|
||||||
assert 0, "fail"
|
|
||||||
|
|||||||
@@ -248,8 +248,7 @@ impl Context {
|
|||||||
gsp.update_endpoints(&endpoints)?;
|
gsp.update_endpoints(&endpoints)?;
|
||||||
}
|
}
|
||||||
anyhow::Ok(())
|
anyhow::Ok(())
|
||||||
})
|
});
|
||||||
.await??;
|
|
||||||
Ok(Iroh {
|
Ok(Iroh {
|
||||||
endpoint,
|
endpoint,
|
||||||
gossip,
|
gossip,
|
||||||
|
|||||||
Reference in New Issue
Block a user