summaryrefslogtreecommitdiff
path: root/ext/websocket/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/websocket/lib.rs')
-rw-r--r--ext/websocket/lib.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs
index 4195f39b8..8eac3e350 100644
--- a/ext/websocket/lib.rs
+++ b/ext/websocket/lib.rs
@@ -403,6 +403,20 @@ pub enum SendValue {
}
#[op]
+pub async fn op_ws_send_text(
+ state: Rc<RefCell<OpState>>,
+ rid: ResourceId,
+ data: String,
+) -> Result<(), AnyError> {
+ let resource = state
+ .borrow_mut()
+ .resource_table
+ .get::<WsStreamResource>(rid)?;
+ resource.send(Message::Text(data)).await?;
+ Ok(())
+}
+
+#[op]
pub async fn op_ws_send(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
@@ -504,6 +518,7 @@ deno_core::extension!(deno_websocket,
op_ws_send,
op_ws_close,
op_ws_next_event,
+ op_ws_send_text,
],
esm = [ "01_websocket.js", "02_websocketstream.js" ],
options = {