mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
parent
80ed54a4b6
commit
d76014192d
1 changed files with 12 additions and 6 deletions
|
@ -505,9 +505,12 @@ pub fn op_ws_try_send_string(
|
|||
state: &mut OpState,
|
||||
rid: ResourceId,
|
||||
text: String,
|
||||
) -> Result<bool, AnyError> {
|
||||
let resource = state.resource_table.get::<WsStreamResource>(rid)?;
|
||||
resource.try_send(Message::Text(text))
|
||||
) -> bool {
|
||||
let resource = match state.resource_table.get::<WsStreamResource>(rid) {
|
||||
Ok(resource) => resource,
|
||||
Err(_) => return false,
|
||||
};
|
||||
resource.try_send(Message::Text(text)).is_ok()
|
||||
}
|
||||
|
||||
#[op(fast)]
|
||||
|
@ -515,9 +518,12 @@ pub fn op_ws_try_send_binary(
|
|||
state: &mut OpState,
|
||||
rid: u32,
|
||||
value: &[u8],
|
||||
) -> Result<bool, AnyError> {
|
||||
let resource = state.resource_table.get::<WsStreamResource>(rid)?;
|
||||
resource.try_send(Message::Binary(value.to_vec()))
|
||||
) -> bool {
|
||||
let resource = match state.resource_table.get::<WsStreamResource>(rid) {
|
||||
Ok(resource) => resource,
|
||||
Err(_) => return false,
|
||||
};
|
||||
resource.try_send(Message::Binary(value.to_vec())).is_ok()
|
||||
}
|
||||
|
||||
#[op(deferred)]
|
||||
|
|
Loading…
Reference in a new issue