Possibility of multiple listening ports

Hihi,

I’ve recently managed to create a working telegram bot and is really happy about it.
To further improve the bot, I’m trying to expose part of the JSON collected via telegram to publish a map but soon realise that using express and listening to “process.env.ENV” (same as the telegram bot) results in ‘Error: listen EADDRINUSE 0.0.0.0:3000’ due to the multiple listens and disabling one of the listens(telegrambot/express) would enable to other to work.

hence i would like to query if it is possible to have 2 ports listening at the same time so the telelgram bot can work and at the same time expose data for the website to work.

I do realise that a work around is to use the app to write part of the data onto a json host such as ‘http://myjson.com/’ and have a glitch website retrieve the json data from the json host. if listening on multiple ports is not feasible I’ll use the work around :smile:

Cheers!

1 Like

This question already has an answer here

do you have a working example? i’ve no idea how to use that… :slight_smile:

Right now, your project can only have one port open to the outside world, so you can’t just set the listeners up on different ports. If you’re able to tell the requests apart from each other, then you can put a proxy in front of both. There’s an example of doing that here: https://glitch.com/edit/#!/debugger

1 Like

Hi @Gareth following that link produces this error message:

Unexpected Error
(シ_ _)シ
An error has occurred, please try again or contact us if the error persists.

It works ok for me, I suggest trying it again.

It would be nice to have hot reload working with it’s seperate port