# actix_web::ws::WsWriter - Rust
API documentation for the Rust `WsWriter` trait in crate `actix_web`.
Keywords: rust, rustlang, rust-lang, WsWriter

# Trait actix_web::ws::WsWriter [−] [src]

    pub trait WsWriter {
        fn send_text<T: Into<Binary>>(&mut self, text: T);
        fn send_binary<B: Into<Binary>>(&mut self, data: B);
        fn send_ping(&mut self, message: &str);
        fn send_pong(&mut self, message: &str);
        fn send_close(&mut self, reason: Option<CloseReason>);
    }

Common writing methods for a websocket.

## Required Methods

### `fn send_text<T: Into<Binary>>(&mut self, text: T)`

Send a text

### `fn send_binary<B: Into<Binary>>(&mut self, data: B)`

Send a binary

### `fn send_ping(&mut self, message: &str)`

Send a ping message

### `fn send_pong(&mut self, message: &str)`

Send a pong message

### `fn send_close(&mut self, reason: Option<CloseReason>)`

Close the connection

## Implementors

- `impl WsWriter for ClientWriter` | [src]

- `impl<A, S> WsWriter for WebsocketContext<A, S> where A: Actor<Context = Self>, S: 'static,` | [src]

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)