star-micronics / react-native-star-io10

react-native-star-io10 is a library for supporting application development for Star Micronics devices.
Other
83 stars 54 forks source link

Multiple opened connections #20

Open joarwilk opened 2 years ago

joarwilk commented 2 years ago

Hi,

Is it possible to have multiple opened connections to one printer? For example multiple POS-devices getting status updates from the same printer.

Also, is there a way to prevent a printer from being stuck in an "opened" mode?

Thanks

gare-bear commented 2 years ago

@joarwilk the short answer is no its not possible. There's lots of reasons why and sometimes they will depend on the printer OR interface OR the device being used for printing.

To your second question, the simplest way is to close the connection after each print, especially if you plan on sharing the printer among multiple devices.

joarwilk commented 2 years ago

Thank you for the answer.

Just so we are aware, a standard "open, get status, close" process, how long would you expect that to take? Is it reasonably to have multiple (15) POS devices ping multiple (10) printers every 5s or so for status and not have them collide?

gare-bear commented 2 years ago

Just so we are aware, a standard "open, get status, close" process, how long would you expect that to take?

@joarwilk a few seconds but really it depends on a variety of factors such as the connection type, the type of receipt (text or image-based) and the length of the receipt. BLE is the slowest, LAN being the fastest (shareable) connection type. For a 6" receipt, on a LAN printer, I'd say approximately 5 seconds.

Is it reasonably to have multiple (15) POS devices ping multiple (10) printers every 5s or so for status and not have them collide?

Unfortunately, I think you're going to see lots of collisions. Instead, I'd suggest you check the printer status before attempting to print. If you're unsuccessful connecting to the printer, then you can choose a different (from your 10) printers.