How do I connect my HTML document to my Heroku server

I recently learned and I made a simple app with it, and then published it on a heroku app.

They say you should write this code in your html document for

$(document).ready(function () {
const socket = io();

$('form').submit((e) => {

socket.emit('chat message', $('#m').val());
return false;

socket.on('chat message', (msg) => {
$('#messages').append(`<li>Message: ${msg}</li>`);

This is from’s documentation page.

But I can’t figure out how I connect to my heroku app were my’s index.js lies so my html document can read the emitted events.

Nevermind, I solved it! Just put your heroku app url inside io([here]).

1 Like

Hey @sebastianelstadt, Thanks for coming back to share what worked for you!