We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If there's new data update from Rust, is there any way to send it from Rust to TypeScript?
I also found Notification, but it seems to be Notifications from TypeScript to Rust. #56
The text was updated successfully, but these errors were encountered:
In deltachat we switched to a fetch next event loop (long polling) on the client:
while (true) { let event = await rpc.getNextEvent() }
Our actual implementation:
https://github.com/deltachat/deltachat-core-rust/blob/bce5203eebc95357d293ee948f78f1c96a057db9/deltachat-jsonrpc/typescript/src/client.ts#L45-L61
If you do your own transport for jsonrpc you can also inject your own notification messages, we did this previously in deltachat. (the commit that changed it from notifications to long polling: deltachat/deltachat-core-rust@514074d#diff-7151c7c6805a166dc5109686642fbd1c6e9a667279da9fa5d365f997cb9874b8)
Basically looked like this:
async fn handler(ws: WebSocketUpgrade, Extension(api): Extension<CommandApi>) -> Response { let (client, out_receiver) = RpcClient::new(); let session = RpcSession::new(client.clone(), api.clone()); tokio::spawn(async move { let events = api.accounts.read().await.get_event_emitter(); while let Some(event) = events.recv().await { let event = event_to_json_rpc_notification(event); client.send_notification("event", Some(event)).await.ok(); } }); handle_ws_rpc(ws, out_receiver, session).await }
Sorry, something went wrong.
No branches or pull requests
If there's new data update from Rust, is there any way to send it from Rust to TypeScript?
I also found Notification, but it seems to be Notifications from TypeScript to Rust.
#56
The text was updated successfully, but these errors were encountered: