@@ -1915,17 +1915,20 @@ pub type WsMessage(a) {
1915
1915
/// This connection is used from within a websocket handler function to
1916
1916
/// send data to the client via `WsSendText` or `WsSendBinary`
1917
1917
///
1918
- pub type WsConnection =
1918
+ type WsConnection =
1919
1919
fn ( WsSend ) -> Result ( Nil , WsError )
1920
1920
1921
- /// A socket connection used to connect to clients .
1921
+ /// A capability used to support websocket execution from a capable server .
1922
1922
///
1923
1923
/// This is provided by a websocket capable server's handler
1924
1924
/// function. It is required to turn a http connection into an
1925
1925
/// active websocket (`WsConnection`).
1926
1926
///
1927
1927
pub type WsCapability ( state, msg) {
1928
- WsCapability ( fn ( Request , WsHandler ( state, msg) ) -> Response )
1928
+ WsCapability (
1929
+ handler : fn ( Request , WsHandler ( state, msg) ) -> Response ,
1930
+ ws : internal . WsCapability ,
1931
+ )
1929
1932
}
1930
1933
1931
1934
/// Configuration for a websockets creation and life-cycle.
@@ -2050,7 +2053,7 @@ pub type WsError {
2050
2053
///
2051
2054
/// This takes all the parameters required to begin a websocket session with a
2052
2055
/// client and requires a websocket capabile web server such as mist which
2053
- /// provides the `WsCapability` as part of it's handler function.
2056
+ /// provides the `WsCapability` as part of its handler function.
2054
2057
///
2055
2058
/// ```gleam
2056
2059
/// wisp.WsHandler(handler, on_init, on_close) |> wisp.websocket(req, ws_capability)
@@ -2061,6 +2064,6 @@ pub fn websocket(
2061
2064
req : Request ,
2062
2065
capability : WsCapability ( state, msg) ,
2063
2066
) -> Response {
2064
- let WsCapability ( do_websocket ) = capability
2067
+ let WsCapability ( do_websocket , _ ) = capability
2065
2068
do_websocket ( req , handler )
2066
2069
}
0 commit comments