Pop the next incoming message. Use `while let Some(msg) = ws.recv()` to drain all messages that arrived since the last frame.
(&self)
| 81 | /// Use `while let Some(msg) = ws.recv()` to drain all messages |
| 82 | /// that arrived since the last frame. |
| 83 | pub fn recv(&self) -> Option<WsMessage> { |
| 84 | let mut mgr = super::NET_MANAGER.lock().unwrap(); |
| 85 | let entry = mgr.websockets.get_mut(&self.id)?; |
| 86 | entry.frames_not_accessed = 0; |
| 87 | entry.state.try_recv() |
| 88 | } |
| 89 | |
| 90 | /// Graceful close. Consumes the handle and removes the entry immediately. |
| 91 | pub fn close(self) { |