locked
Missing APIs in Windows 10 for communication between UWP app and Edge extension on same machine RRS feed

  • Question

  • Hi, 

    I have developed a Edge extension that need to communicate to an UWP (developed by myself) installed on same machine. But there seems no way to do achieve this.

    I have tried following methods but both they were in vain.

    Method 1: Through Web-sockets on loopback
    =========================================
    I ran a server in UWP App, listening on local port and my Edge extension act as a client to request data from UWP App.

    Observation: Failed. Microsoft sandbox restrictions on UWP apps do not allow TCP communication on localhost. As both Edge and my app, are sandboxed UWP apps, hence this method fails. 

    Hack: I can make it work by disabling net-isolation of both Edge and UWP app by following command as admin.
    CheckNetIsolation.exe LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
    CheckNetIsolation.exe LoopbackExempt -a -n="my app"

    Its ok on development machine but you can not recommend this to your customers.

    Remarks: At least TCP communication between extension and UWP app by the same publisher should be allowed as both will be available from Store and certified by Microsoft. I don't see any security risk in it.

    Method 2: By using Application Service
    ======================================
    Microsoft has provided App services APIs for communication between two UWP Apps and we have also tried them for our objective.

    Observation: Failed. Edge extension has no access to App Service namespace. So, despite being an UWP app, Edge can't communicate (or restricting its extensions) with local App service. A feature request is raised here:
    https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/15206358-calling-consuming-an-app-service-from-edge-extensi

    Remarks: Microsoft is not the only OS supporting the Sandboxed environment and shouldn’t practice this approach of barring all communication for security as it is very toxic for its developers like us. 

    Please help me resolving this problem.

    Wednesday, July 27, 2016 1:23 PM

All replies

  • You can post suggestions and requests for Edge Extensions at https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/category/87962-extensions

    Also take a look at the  Extension API roadmap

    For discussion of writing Edge Extensions see https://developer.microsoft.com/en-us/microsoft-edge/community/support/

    Wednesday, July 27, 2016 7:41 PM
  • Hi Jatin_Sharma,

    thanks for posting here.

    Have you tried these methods?

    1.You could use both Windows.Networking.Sockets and Winsock to communicate with other devices as a UWP app developer.

    2. HttpClient which use Windows.Web.Http namespace API to send and receive information using the HTTP 2.0 and HTTP 1.1 protocols.

    For more networking and web services technologies, please refer to this link below.

    https://msdn.microsoft.com/en-us/windows/uwp/networking/index

    If these still could not work, please connect to Microsoft to post a question.

    Best Regards,

    Sera Yu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Monday, August 1, 2016 8:12 AM
  • Please read the post carefully. I need a solution for localhost communication eka on same device.

    I can use all the apis you listed in UWP app and can communicate to/from other device but not on the same device. This is precisely the sandbox restriction on UWP apps.
    Wednesday, August 3, 2016 1:13 PM
  • Hi,

    I've got a similar problem.

    I've created two UWP apps (client and server). They should communicate with each other via JSON/HTTP.

    When one apps runs on machine A and other on machine B, all is fine.

    The problem arises when both apps run on the same machine:

    - One UWP app (server) serves HTTP requests on localip:8800 (works fine when called from other devices)

    - Other UWP app (client) on same machine, tries to connect to localhost:8800 OR to localip:8800 > does not work

    I've tried to add a "LoopbackExempt" with checknetisolation.exe for both UWP apps, but to no avail.

    Both apps have capabilities "Internet client/server" and "local network client/server" checked in VS2017.

    I've tried different browsers (Edge, IE, Chrome) - none of them can access my JSON API at 127.0.0.1:8800.

    Only method to get the communication to my "server" app working is to:

    - disable windows firewall (from control panel)

    - net stop MpsSvc (from elevated prompt)

    - start both apps > communication between apps works fine

    What is this silly security policy about? I can access my app from other devices, but not from localhost?

    (I'm running "Win10 Enterprise x64 10.0.14393.206 (build 14393)", Visual Studio 2017, if this matters)

    What do I need to configure to allow localhost network communication BETWEEN TWO UWP apps? (I'd rather not like to disable my firewall permanently!)

    regards


    • Edited by dennissc Sunday, May 28, 2017 11:28 AM
    Sunday, May 28, 2017 11:26 AM
  • about:flags > Allow localhost loopback

    Rob^_^

    Wednesday, May 31, 2017 2:50 AM