From 0624beca54f4d342a0000f18b90791d80c218cb2 Mon Sep 17 00:00:00 2001 From: scratchyone <scratchywon@gmail.com> Date: Wed, 23 Dec 2020 21:23:31 -0500 Subject: [PATCH] Rename BlockingClient to PollingClient --- examples/index.html | 2 +- examples/{blocking.rs => polling.rs} | 2 +- src/lib.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename examples/{blocking.rs => polling.rs} (92%) diff --git a/examples/index.html b/examples/index.html index 263feb8..b1930e1 100644 --- a/examples/index.html +++ b/examples/index.html @@ -22,7 +22,7 @@ </style> </head> <script type="module"> - import init from '../target/blocking.js'; + import init from '../target/polling.js'; init(); </script> </html> diff --git a/examples/blocking.rs b/examples/polling.rs similarity index 92% rename from examples/blocking.rs rename to examples/polling.rs index 4a5d01a..1a864c7 100644 --- a/examples/blocking.rs +++ b/examples/polling.rs @@ -13,7 +13,7 @@ fn main() -> Result<(), JsValue> { info!("Creating connection"); // Client is wrapped in an Rc<RefCell<>> so it can be used within setInterval - let client = Rc::new(RefCell::new(wasm_sockets::BlockingClient::new( + let client = Rc::new(RefCell::new(wasm_sockets::PollingClient::new( "wss://echo.websocket.org", )?)); diff --git a/src/lib.rs b/src/lib.rs index bba0d95..b3d17b5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,14 +89,14 @@ pub enum Message { Text(String), Binary(Vec<u8>), } -pub struct BlockingClient { +pub struct PollingClient { pub url: String, pub event_client: EventClient, pub status: Rc<RefCell<ConnectionStatus>>, pub data: Rc<RefCell<Vec<Message>>>, } // TODO: Replace unwraps and JsValue with custom error type -impl BlockingClient { +impl PollingClient { pub fn new(url: &str) -> Result<Self, JsValue> { // Create connection let mut client = EventClient::new(url)?; -- GitLab