Skip to content
Snippets Groups Projects
Unverified Commit 0624beca authored by scratchyone's avatar scratchyone
Browse files

Rename BlockingClient to PollingClient

parent 92d1cc78
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@
</style>
</head>
<script type="module">
import init from '../target/blocking.js';
import init from '../target/polling.js';
init();
</script>
</html>
......@@ -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",
)?));
......
......@@ -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)?;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment