Get a handle to an existing WebSocket. Returns `None` if no such ID.
(id: &str)
| 439 | |
| 440 | /// Get a handle to an existing WebSocket. Returns `None` if no such ID. |
| 441 | pub fn ws(id: &str) -> Option<WebSocket> { |
| 442 | let key = hash_id(id); |
| 443 | let mut mgr = NET_MANAGER.lock().unwrap(); |
| 444 | let entry = mgr.websockets.get_mut(&key)?; |
| 445 | entry.frames_not_accessed = 0; |
| 446 | Some(WebSocket { id: key }) |
| 447 | } |
| 448 | |
| 449 | #[cfg(not(target_arch = "wasm32"))] |
| 450 | #[derive(Debug)] |