Search code examples
dartsend-port

Communication between program running on Standalone VM and Browser based App


If a communication mechanism has to be established between a stand-alone Dart VM and browser based application on the same machine, how can this be achieved in DART.

The dart:io library does not work in browser-based applications.

Hence, using SendPort/ReceivePort cannot be used.


Solution

  • I think you could:

    • use WebSockets on the Browser side and
    • use a (Server)Socket on the stand-alone dart VM to listen for incoming websockets.

    Regards, Robert

    EDIT

    A long time ago I wrote a nodejs server side implementation of a websocket-server - maybe this helps you do setup the server side if you decide to use websockets:

    https://github.com/roberthartung/kit_websocket