I'm trying to build a Chrome app and/or extension to communicate with a serial device (using https://developer.chrome.com/apps/serial), to use for showing data from the device on a webpage.
I've created an app that can read messages from my device but I now need to get those messages to my webpage. My plan was to create an extension that communicates with my app and then updates my webpage. My extension sends messages to the app using "chrome.runtime.sendMessage" and my app then responds with messages containing information from my device.
This works fine when the app is running but when I close my app it stops listening for new messages. Is there any way to always keep my app listening to new messages?
The reason I've created an app (and not just an extension) from the start is because extensions are not allowed to communicate with serial devices. Is there some other way than building both an app and an extension I can achieve what I want?
Update:
I just realized that I can send messages directly to the app from my webpage using "chrome.runtime.sendMessage", so I guess that the extension isn't needed. I however still need the app to be listening to messages all the time.