actix / examples

Community showcase and examples of Actix Web ecosystem usage.
Apache License 2.0
3.7k stars 807 forks source link

websocket example does not work #325

Closed ta3pks closed 4 years ago

ta3pks commented 4 years ago

cargo run --bin websocket-server fires the server up on port 8080 on firefox new WebSocket("ws://127.0.0.1:8080") says Firefox can’t establish a connection to the server at ws://127.0.0.1:8080/ however I see the log actix_web::middleware::logger] 127.0.0.1:58886 "GET / HTTP/1.1" 200 2394 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0" 0.000666 on the console

I also tried using websocat the response is

websocat: WebSocketError: Received unexpected status code
websocat: error running
rustrust commented 4 years ago

Relevant to https://github.com/actix/actix-web/issues/1006

mlodato517 commented 4 years ago

Is it because the resource is /ws/? I think I see it work if I use:

const ws = new WebSocket("ws://127.0.0.1:8080/ws/")
// wait a second to connect
ws.readyState === ws.OPEN