Hello developers! My current issue is i have a discord bot thats on a hosting platform that works fine, and before i was hosting i was localhosting with a port and sending data between roblox and the bot.
now that i tried using the server IP along with the provided PORT on the server, it no longer works and i get a connect fail error when trying to send data the to JS file on the server.
i tried using IP 0.0.0.0:Port of my server here, but got the same issue, anyone know what i cna do?
below is the roblox code, data is for testing
local HttpService = game:GetService("HttpService")
local data = {
playerName = "yoda962",
level = 12,
rank = "Elite",
stats = {
kills = 45,
deaths = 7
}
}
local jsonData = HttpService:JSONEncode(data)
local success, response = pcall(function()
return HttpService:PostAsync("http://<ServerIP>:<Port>/roblox-data", jsonData, Enum.HttpContentType.ApplicationJson)
end)
if success then
print("Data sent successfully to the Express server.")
else
warn("Failed to send data: " .. response)
end
heres the node JS script, and of course for both my IP and port are hidden as it connects to my server
const express = require('express');
const app = express();
app.use(express.json());
let robloxData = {};
app.post('/roblox-data', (req, res) => {
robloxData = req.body;
console.log("Received data from Roblox:", robloxData);
res.sendStatus(200);
});
app.get('/roblox-data', (req, res) => {
res.json(robloxData);
});
app.listen(ServerIP, Port () => {
console.log(`Express server listening at http://<ServerIP><Port>:}`);
});
you can either make your own api which you need to be open to the rest of the internet OR you can use Discord webhooks to send json strings to discord that your bot picks up and parses
edit: also just to clarify, with your server ip, are you entering your local ip or your public ip? your local ip is the one you view on your computer through control panel or running ipconfig, your public ip is one you can get by searching up “what is my ip?”
i used local before hosting, which worked fine, my current issue is Failed to send data: HttpError: SslConnectFail and i can hardly find any info on what an sslconnectfail is? right now on roblox it posts to https://SERVERIP:PORT/roblox-data
this solution seemed to work best, i used a webhook and logged it on my server, if possible id like to skip the webhook step but worked the best, thanks!