denoland / fastwebsockets

A fast RFC6455 WebSocket implementation
https://docs.rs/fastwebsockets/
Apache License 2.0
881 stars 66 forks source link

How to close a websocket connection? #69

Closed radudiaconu0 closed 9 months ago

radudiaconu0 commented 9 months ago

Is there a way to close a websocket connection in the way uWebsockets does or websocket.rs? in webs-socket.rs case they faev soemthing like ws.close("bye") in uwebsockets case they have somehting like ws.end(some_code) or ws.close() i cant find anything in the docs

littledivy commented 9 months ago

Write a close frame:

ws.write_frame(Frame::close(1000, &[])).await?;