Reactive!
cool 😁 I was quite interested in the "reactive" branding you guys had. Is that based on the push/pull sub/pub model of "reactive" programming?
28 Replies
The pub/sub part is there but that feels like an implementation detail, the core thing is writing imperative code (query functions) that act like declarative/reactive data views
via some cool implementation details (tracking database reads, deterministic execution etc.) Convex knows when to push new data to clients
Hm ok, I will need to do the tutorial to see how it differs from trpc
Please let us know if you have questions after! Hopefully the first page of the tutorial makes this clear.
tRPC is really sweet, some ways Convex goes beyond tRPC are
- consistent views of data: all endpoints update simultaneously, in the same React render
- streaming by default: every query updates only when it has changed
yes, tRPC, or RPCs in general, aren't designed for pub/sub but it's sooo good at what it does, which is being better than REST lol
Hmmm, one issue I just found is that the dev server doesn't complain if the port is already in use 👀
the frontend or backend dev server? for me backend does notice, and the frontend dev server chooses a different port
the frontend dev server didn't choose a different port for me, so I got confused when I hit another create-<blank>-app I had running
ah ok I can repro this with
nc -l 3000
in one terminal and npm run dev
in another. I think this is a limitation of how Vite detects ports in use.I see 👀
something like this https://github.com/vitejs/vite/issues/7016
yeah
What was the other project? perhaps it was bound to 0.0.0.0:3000 instead of localhost:3000
(but regardless, probably not going to be able to fix this soon)
but thank you, this is just the kind of problem we'd love to hear about
It was the create-t3-app running the next.js dev server
and yes, you were right, it was bound to 0.0.0.0

sounds like something for Vite and Next.js to work out between themselves 😆
although maybe Vite could check both? filed @vlmlee https://github.com/vitejs/vite/issues/10638
The beauty of OSS
They like the idea, now to wait for a flight this weekend to write the PR
I dug into the code but it's not apparent how they check for an occupied port other than
onError
here: https://github.com/vitejs/vite/blob/ee7c28a46a6563d54b828af42570c55f16b15d2c/packages/vite/src/node/http.ts#L163GitHub
vite/http.ts at ee7c28a46a6563d54b828af42570c55f16b15d2c · vitejs/v...
Next generation frontend tooling. It's fast! Contribute to vitejs/vite development by creating an account on GitHub.
probably just need to add logic for checking the
host
variable, for transforming 0.0.0.0 and 127.0.0.1 into one anotherDon't really know if this applies for this use case

yeah maybe we need to actually try to connect to check, hopefully there's some syscall that tells us
hm yeah, currently the server starts first and waits for an error
a precheck though might not be the right answer since it makes the error checking event listener redundant
there might be a better solution within
node.http
with a setting or somethingwe could add a health check after setting up the server
not sure what the right answer is... It doesn't seem like the nextjs dev server cares that vite is running on
localhost:3000
anyways by running vite dev server first then nextjs
you can get to the convex app through 0.0.0.0:3000
however when running both apps so it's definitely a bug
In the context of servers, 0.0.0.0 means "all IPv4 addresses on the local machine." If a host has two IP addresses, and a server running on the host listens to 0.0.0.0, it will be reachable by both of those IPs
seems kinda deliberate on next.js's part or maybe they didn't really know the difference, like how I don't really understand the difference
doesn't look like there's a configuration for this problemhttps://superuser.com/questions/949428/whats-the-difference-between-127-0-0-1-and-0-0-0-0 link for interesting info
Super User
What's the difference between 127.0.0.1 and 0.0.0.0?
I understand that 127.0.0.1 points to localhost, and so does 0.0.0.0 (correct me if I'm wrong). So, what's the difference between 127.0.0.1 and 0.0.0.0?
yeah I think it's reasonable that they use 0.0.0.0, I bet that's what using
--host
with vite does
prefer Vite's default for security thoughyes, it's commented here: https://github.com/vitejs/vite/blob/ee7c28a46a6563d54b828af42570c55f16b15d2c/packages/vite/src/node/utils.ts#L826
GitHub
vite/utils.ts at ee7c28a46a6563d54b828af42570c55f16b15d2c · vitejs/...
Next generation frontend tooling. It's fast! Contribute to vitejs/vite development by creating an account on GitHub.
Forgot to mention this resolver
actually, I'm coming around to this as a good solution
@ballingt looks like the person who replied provided a fix 👀 https://github.com/vitejs/vite/pull/10651/commits/f69a78f6382a09309730a97400bf512d4ea04f40
GitHub
fix: already in use port #10638 by Scttpr · Pull Request #10651 · v...
Description
This PR is solving issue 10638.
After a short investigation, recent NodeJS versions will not detect running processes on 0.0.0.0:<desired_port> if the provided host is lo...