
creminology
Real Time Phoenix Errata P32: wscat doesn't accept localhost
While I can load the website at either localhost:4000
or 127.0.0.1:4000
, the wscat
command is only working for me when I use 127.0.0.1:4000
.
So, to connect, it’s:
wscat -c 'ws://127.0.0.1:4000/socket/websocket?vsn=2.0.0'
I don’t see anyone else having this issue at the wscat repository. I’m on a fresh M1 Mac using the default zsh shell. My /etc/hosts
file has the expected link between 127.0.0.1
and localhost
.
Just wanted to note this in case anyone reaching this page in the book got frustrated and didn’t think to try switching from localhost
to 127.0.0.1
. And maybe it’s only an issue on my setup.
First Post!

sb8244
Thanks for this report. I’m unsure of the specifics regarding M1 and why it may not work to resolve localhost
. It’s good that you found a solution that works for your case. I could see this being addressed as a footnote / callout in case others run into issues.
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /zig
- /html
- /scala
- /debian
- /nixos
- /lisp
- /agda
- /react-native
- /sublime-text
- /textmate
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /manjaro
- /spring
- /django
- /diversity
- /lua
- /nodejs
- /julia
- /slackware
- /c
- /neovim