data WsMessage
A message received on a WebSocket. For Text the field text is set, for Binary/Ping/Pong the field data;
for Close the fields code and reason.
Example:
use std.http { WsMessage, WsKind }
fn main() io {
let m = WsMessage{ kind: WsKind.Text, text: "hello" }
print("{m.text} {m.code}")
}Output
hello 0
pub(api) data WsMessageSince. 1.0.0-beta
Fields
pub(api) kind: WsKind | Kind of the message. |
pub(api) text: str = "" | The text of a |
pub(api) payload: bytes = Utf8.encode("") | The data of a |
pub(api) code: i64 = 0 | The close code of a |
pub(api) reason: str = "" | The close reason of a |
Defined in: std/http/http.oxl:2101