What IPC method should I use between Firefox extension and C# code running on the same machine?
- by Rory
I have a question about how to structure communication between a (new) Firefox extension and existing C# code.
The firefox extension will use configuration data and will produce other data, so needs to get the config data from somewhere and save it's output somewhere. The data is produced/consumed by existing C# code, so I need to decide how the extension should interact with the C# code.
Some pertinent factors:
It's only running on windows, in a relatively controlled corporate environment.
I have a windows service running on the machine, built in C#.
Storing the data in a local datastore (like sqlite) would be useful for other reasons.
The volume of data is low, e.g. 10kb of uncompressed xml every few minutes, and isn't very 'chatty'.
The data exchange can be asynchronous for the most part if not completely.
As with all projects, I have limited resources so want an option that's relatively easy.
It doesn't have to be ultra-high performance, but shouldn't add significant overhead.
I'm planning on building the extension in javascript (although could be convinced otherwise if really necessary)
Some options I'm considering:
use an XPCOM to .NET/COM bridge
use a sqlite db: the extension would read from and save to it. The c# code would run in the service, populating the db and then processing data created by the service.
use TCP sockets to communicate between the extension and the service. Let the service manage a local data store.
My problem with (1) is I think this will be tricky and not so easy. But I could be completely wrong? The main problem I see with (2) is the locking of sqlite: only a single process can write data at a time so there'd be some blocking. However, it would be nice generally to have a local datastore so this is an attractive option if the performance impact isn't too great. I don't know whether (3) would be particularly easy or hard ... or what approach to take on the protocol: something custom or http.
Any comments on these ideas or other suggestions?
UPDATE: I was planning on building the extension in javascript rather than c++