Skip to content

Commit

Permalink
Spawn local gateway task on wasm32
Browse files Browse the repository at this point in the history
  • Loading branch information
bitfl0wer committed Nov 20, 2023
1 parent 0acf3fb commit 325c3d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gateway/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,14 @@ impl Gateway {
};

// Now we can continuously check for messages in a different task, since we aren't going to receive another hello
#[cfg(not(target_arch = "wasm32"))]
task::spawn(async move {
gateway.gateway_listen_task().await;
});
#[cfg(target_arch = "wasm32")]
task::spawn_local(async move {
gateway.gateway_listen_task().await;
});

Ok(GatewayHandle {
url: websocket_url.clone(),
Expand Down

0 comments on commit 325c3d3

Please sign in to comment.