amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
18.06k stars 1.16k forks source link

How to have a gun relay server #1179

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi @amark just wanted know if there is any way we can make a relay server for gun

Shigetorum635 commented 2 years ago

You can!

const gunLib = require("gun")

const server = require('http').createServer().listen(8080);

const gun = gunLib({
    web: server
});

You just need to use this code! (It's all available in the documentation at https://gun.eco)

Shigetorum635 commented 2 years ago

You can!

const gunLib = require("gun")

const server = require('http').createServer().listen(8080);

const gun = gunLib({
   web: server
});

You just need to use this code! (It's all available in the documentation at https://gun.eco)

There's also an official example https://github.com/amark/gun/blob/master/examples/http.js

ghost commented 2 years ago

Thanks a lot!!

cheng-alvin commented 1 year ago

Thanks legend! That worked for me as well!