freshworkstudio / gps-google-maps-socket-io

GPS Google Maps Socket.io Demo App
MIT License
21 stars 25 forks source link

Tracking multiple devices #3

Open invaderb opened 7 years ago

invaderb commented 7 years ago

Greetings,

I'm starting to get the hang of the library and created a custom adapter for my GPS device and have it sending data however is it possible to track multiple different devices at the same time?

Lets say I have my GPS device and the TK103 in the index.js under the var options = { 'debug' : false, 'port' : 8090, 'device_adapter' : "TK103", 'device_adapter' : "AB100" } However what ever is set as the last device_adapter is what the app is looking for.

any advice would be greatly appreciated!

gdespirito commented 7 years ago

If you want to listen for a different device, you have to start a new server listening another port.

On Fri, Apr 14, 2017, 15:48 invaderb notifications@github.com wrote:

Greetings,

I'm starting to get the hang of the library and created a custom adapter for my GPS device and have it sending data however is it possible to track multiple different devices at the same time?

Lets say I have my GPS device and the TK103 in the index.js under the var options = { 'debug' : false, 'port' : 8090, 'device_adapter' : "TK103", 'device_adapter' : "AB100" } However what ever is set as the last device_adapter is what the app is looking for.

any advice would be greatly appreciated!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/freshworkstudio/gps-google-maps-socket-io/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDWhu-CD0QAOshltFp9WjhRgCjZIkICks5rv79ggaJpZM4M9_n8 .

--

GONZALO DE-SPIRITO ZÚÑIGA | Web Development FRESHWORK STUDIO CHILE

Móvil: +56 9 8815 3776 | gonzalo@freshworkstudio.com gonzalo@freshworkstudio.com

Cuida el medio ambiente. No imprimas este e-mail a menos que sea necesario.

invaderb commented 7 years ago

So would it be possible to display multiple devices on a map with this library?

gdespirito commented 7 years ago

Yes, you can, but you need to different servers to listen for different types of devices. In one nodejs app you can have those two servers running simultaneously

On Fri, Apr 14, 2017, 18:15 invaderb notifications@github.com wrote:

So would it be possible to display multiple devices on a map with this library?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/freshworkstudio/gps-google-maps-socket-io/issues/3#issuecomment-294238209, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDWhjlHodEukFnmbIzOQ5XCdeaNk591ks5rv-HtgaJpZM4M9_n8 .

--

GONZALO DE-SPIRITO ZÚÑIGA | Web Development FRESHWORK STUDIO CHILE

Móvil: +56 9 8815 3776 | gonzalo@freshworkstudio.com gonzalo@freshworkstudio.com

Cuida el medio ambiente. No imprimas este e-mail a menos que sea necesario.

invaderb commented 7 years ago

Hmm ok I think I understand

So there are two files that make up the node server index.js and main.js in gps-tracking/lib

in the index.js I'm assuming it would look something like this? var server1 = app.listen(3000); var server2 = app.listen(3000);

var options1 = {}; var options2 = {};

var server1 = gps.server1(options1 ......... ; var server2 = gps.server(options2 .......... ;

would I also need to duplicate the main.js file as well and require is with the module export?

Another question what do the functions export to in the functions.js file?

invaderb commented 7 years ago

Upon further searching socket io should be able to do asynchronous IO on one port but still not sure how to handle the multiple devices.