# http/ws-server Start a WebSocket server (RFC 6455). ## Syntax
[http/ws-server $port ?$opts]
## Parameters - `$port` — TCP port to listen on (number) - `$opts` — optional map; `:on-connect` is a closure invoked with the new `ws_conn` resource on each upgrade ## Examples
set srv [http/ws-server 9000 %{
  :on-connect {|conn|
    [http/ws-on-message $conn {|msg| echo "recv:" $msg~data]}
  }
}]
## Returns `ws_server` resource handle. Stop with `http/ws-stop`. ## See Also `http/ws-connect`, `http/ws-stop`, `http/ws-on-message`