What IPC method should I use between Firefox extension and C# code running on the same machine?

后端 未结 4 1931
野性不改
野性不改 2021-01-03 05:49

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

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-03 06:29

    The option I selected was #2: use a sqlite db. Main advantages being:

    • possible to implement in javascript
    • using a sqlite db useful for other reasons
    • asynchronous communication improves performance: C# code is able to cache all information the firefox extension requires rather than having to prepare it on-demand. FF extension is able to save all data back to the sqlite db rather than needing it handled immediately by C# code.
    • separate layer provides a nice testing-point, e.g. it's possible to run only the FF code and verify the expected results in sqlite, instead of needing a testing harness that operates across FF and C#.

    Clearly some of these are scenario-dependant, so I would definitely not say this is the best general-purpose option for communication between FF extn and C# service.

    UPDATE: We used just a sqlite db initially, and then wanted some synchronous communication so later exposed an http web service from the C# windows service that is called by the FF extension. This web service is now consumed by both the FF extension and other browser extensions. It's nice that it's a web service as it makes it easy to consume by different apps in different languages.

提交回复
热议问题