Listening on two ports or other solution

Hi everyone,

My appliaction get data from GPS. The application must listening on port 3000 eg. I want to have application for viewing this data on the map, but i don’t know, how I can run application for listening on port :80 and :3000.

It’s possible to do this? If not, how I can get some functions? I need meteor app, where on some port will be data imported and on another port viewed.

Thx for any response.
M.

I’m confused why these need to be separate ports?

How are you interfacing with the GPS? From the sounds of things, leave meteor on port 3000 and put an nginx proxy in front of it for port 80, and your user access is handled (port 80 will be mapped by nginx to port 3000). You shouldn’t need a separate port for the GPS, but if you provide more information about how you are interfacing with the GPS, we can provide more help!

Yes, It shoud work.

But I need to have two homepages -> One for listening from GPS (import) and One for application public homepage. It’s possible to do this? How? I have probably set to redirect Nginx from / on port 80 to /some-page on port 3000, it is so?

Thank you very much!

I really need more information about what you are trying to accomplish. Thing is, you are asking for a tailored answer, but not providing a lot of detail off which to tailor that answer.

Okay … :slight_smile: So …

I have a car. I this car is a device for reading data from CANBus (actual speed for example). This data are sending into GSM modul. He sends data on the server via GPRS. On GSM Modul, I can set only two parameters -> IP address and Port. So, when I set this parameters, for example, to 192.168.1.1:3000, the data are sending on this IP and this port.

I have a Meteor App listening on this port. I need to have dispatcher, which will listen for sending data. I think that If I set only ip and port, the data are sending on homepage route (for example 192.168.1.1:3000/).

And when come a user from browser (on port 80), the user can be redirected with Nginx to port 3000. But how I can show a homepage, when the route / is occupied?

Is it understandable?

Thank you.

Do you have any documentation for the GSM module? What kind of request does it make to upload the data?

The Modul sends data in UDP Socket format.

Sorry for late repy, I was waiting for delivery materials.
Thank you.

So the best option I can come up with at this point: two applications. One to accept uploads and plug them into mongo (maybe not a great client for a meteor application there). The other one uses mongo with oplog tailing for the client side of things.

Alternatively, you might be able to squeeze them into one application, but things are going to get complicated.

https://nodejs.org/api/dgram.html gives you some reference points to start with looking at pure node UDP answer (which is what you’ll need anyways). I don’t know anything about that api as I have never used it myself, but that’s where you start. If you want to incorporate that into a meteor application, you would need to have some kind of “interface” point where you go into meteor mode using Meteor.bindEnvironment(function) which will call the function as if it was called by code already within the Meteor environment (set up the various environment states, add a fiber, etc).