Closed aaronsantiago closed 6 months ago
i just ran your script.. it does work.
i set PORT to 8282 for me
and opened up http://localhost:8282/gun.js and it served the gun.js
i went ahead and coded a index.html
<script src="./gun.js"></script>
<script>
var gun = Gun({peers:["http://localhost:8282/gun"]})
gun.get("hello").get("world").put("ok")
</script>
i added breakpoints into node's-GUN, lib/wire.js (line 70) , it hit the point like it should
, opened up browser and checked to see if the Websocket connects, and inspected the data
everthing works for me
are you still having issues this this?
233.255.255.255:8765/gun = multicast (its for nodejs to nodejs without setup), you cant set that as a peer..
Ah, yes, being able to add a log/breakpoint to wire helped me figure out what's happening. I'm used to opening /gun
on public endpoints to see if it's working but that doesn't work in the express setup.
When I was testing, I was mainly testing in a slightly different environment--and critically I was missing this line:
var gun = Gun({ file: 'data', web: server });
which apparently is needed to enable websocket connections.
Thanks for your response!
Running the sample (slightly modified to use imports) doesn't allow any connections to gun on either
localhost:8765/gun
or233.255.255.255:8765/gun
. Not sure if I'm doing something wrong or if it's straight up broken, but here's the code: