snapview / tokio-tungstenite

Future-based Tungstenite for Tokio. Lightweight stream-based WebSocket implementation
MIT License
1.88k stars 236 forks source link

Is there any example to send request to wss server? #276

Closed sameul2012 closed 1 year ago

sameul2012 commented 1 year ago

Anyone know now to use tokio-tungstenite to send ping request to remote wss server?

As with tungstenite-rs TLS is supported on all platforms using native-tls or rustls through feature flags: native-tls, rustls-tls-native-roots or rustls-tls-webpki-roots feature flags. Neither is enabled by default. See the Cargo.toml for more information. If you require support for secure WebSockets (wss://) enable one of them.

{
    "method":"ping"
}

Verified remote server is alive, got response of

{
    "id": 0,
    "code": 0,
    "msg": "PONG"
}