Skip to content

Commit ce72859

Browse files
committed
[bfops/wasm-update]: fixes
1 parent 22b31bf commit ce72859

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

sdks/rust/src/db_connection.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ use http::Uri;
3939
use spacetimedb_client_api_messages::websocket::{self as ws, common::QuerySetId};
4040
use spacetimedb_lib::{bsatn, ser::Serialize, ConnectionId, Identity, Timestamp};
4141
use spacetimedb_sats::Deserialize;
42-
use std::{
43-
collections::HashMap,
44-
sync::{atomic::AtomicU32, Arc, Mutex as StdMutex, OnceLock},
45-
};
42+
use std::sync::{atomic::AtomicU32, Arc, Mutex as StdMutex, OnceLock};
4643
#[cfg(not(feature = "web"))]
4744
use tokio::{
4845
runtime::{self, Runtime},
@@ -944,7 +941,7 @@ but you must call one of them, or else the connection will never progress.
944941
let connection_id_override = get_connection_id_override();
945942
let ws_connection = WsConnection::connect(
946943
self.uri.clone().unwrap(),
947-
self.module_name.as_ref().unwrap(),
944+
self.database_name.as_ref().unwrap(),
948945
self.token.as_deref(),
949946
connection_id_override,
950947
self.params,
@@ -972,7 +969,6 @@ but you must call one of them, or else the connection will never progress.
972969
))
973970
}
974971

975-
976972
/// Set the URI of the SpacetimeDB host which is running the remote database.
977973
///
978974
/// The URI must have either no scheme or one of the schemes `http`, `https`, `ws` or `wss`.
@@ -1107,7 +1103,6 @@ fn build_db_ctx_inner<M: SpacetimeModule>(
11071103
on_connect: on_connect_cb,
11081104
on_connect_error: on_connect_error_cb,
11091105
on_disconnect: on_disconnect_cb,
1110-
call_reducer_flags: <_>::default(),
11111106

11121107
procedure_callbacks: ProcedureCallbacks::default(),
11131108
}))
@@ -1118,7 +1113,7 @@ fn build_db_ctx<M: SpacetimeModule>(
11181113
#[cfg(not(feature = "web"))] runtime_handle: runtime::Handle,
11191114

11201115
inner_ctx: Arc<StdMutex<DbContextImplInner<M>>>,
1121-
raw_msg_send: mpsc::UnboundedSender<ws::ClientMessage<Bytes>>,
1116+
raw_msg_send: mpsc::UnboundedSender<ws::v2::ClientMessage>,
11221117
parsed_msg_recv: SharedAsyncCell<mpsc::UnboundedReceiver<ParsedMessage<M>>>,
11231118
pending_mutations_send: mpsc::UnboundedSender<PendingMutation<M>>,
11241119
pending_mutations_recv: SharedAsyncCell<mpsc::UnboundedReceiver<PendingMutation<M>>>,
@@ -1232,7 +1227,7 @@ fn spawn_parse_loop<M: SpacetimeModule>(
12321227

12331228
#[cfg(feature = "web")]
12341229
fn spawn_parse_loop<M: SpacetimeModule>(
1235-
raw_message_recv: mpsc::UnboundedReceiver<ws::ServerMessage<BsatnFormat>>,
1230+
raw_message_recv: mpsc::UnboundedReceiver<ws::v2::ServerMessage>,
12361231
) -> mpsc::UnboundedReceiver<ParsedMessage<M>> {
12371232
let (parsed_message_send, parsed_message_recv) = mpsc::unbounded();
12381233
wasm_bindgen_futures::spawn_local(parse_loop(raw_message_recv, parsed_message_send));

sdks/rust/src/websocket.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::sync::Arc;
88
#[cfg(not(feature = "web"))]
99
use std::time::Duration;
1010

11+
#[cfg(not(feature = "web"))]
1112
use bytes::Bytes;
1213
#[cfg(not(feature = "web"))]
1314
use futures::TryStreamExt;
@@ -358,7 +359,7 @@ impl WsConnection {
358359
};
359360

360361
let uri = make_uri(host, db_name, connection_id, params, token.as_deref())?;
361-
let sock = tokio_tungstenite_wasm::connect_with_protocols(&uri.to_string(), &[BIN_PROTOCOL])
362+
let sock = tokio_tungstenite_wasm::connect_with_protocols(&uri.to_string(), &[ws::v2::BIN_PROTOCOL])
362363
.await
363364
.map_err(|source| WsError::Tungstenite {
364365
uri,
@@ -537,8 +538,8 @@ impl WsConnection {
537538
pub(crate) fn spawn_message_loop(
538539
self,
539540
) -> (
540-
mpsc::UnboundedReceiver<ServerMessage<BsatnFormat>>,
541-
mpsc::UnboundedSender<ClientMessage<Bytes>>,
541+
mpsc::UnboundedReceiver<ws::v2::ServerMessage>,
542+
mpsc::UnboundedSender<ws::v2::ClientMessage>,
542543
) {
543544
let websocket_received = CLIENT_METRICS.websocket_received.with_label_values(&self.db_name);
544545
let websocket_received_msg_size = CLIENT_METRICS
@@ -549,8 +550,8 @@ impl WsConnection {
549550
websocket_received_msg_size.observe(msg_size as f64);
550551
};
551552

552-
let (outgoing_tx, outgoing_rx) = mpsc::unbounded::<ClientMessage<Bytes>>();
553-
let (incoming_tx, incoming_rx) = mpsc::unbounded::<ServerMessage<BsatnFormat>>();
553+
let (outgoing_tx, outgoing_rx) = mpsc::unbounded::<ws::v2::ClientMessage>();
554+
let (incoming_tx, incoming_rx) = mpsc::unbounded::<ws::v2::ServerMessage>();
554555

555556
let (mut ws_writer, ws_reader) = self.sock.split();
556557

0 commit comments

Comments
 (0)