1

I know that there WebSockets. I looked at it from itself is an example of language dart.

void initWebSocket([int retrySeconds = 2]) {
  var reconnectScheduled = false;

  outputMsg("Connecting to websocket");
  ws = new WebSocket('ws://echo.websocket.org');

  void scheduleReconnect() {
    if (!reconnectScheduled) {
      new Timer(new Duration(milliseconds: 1000 * retrySeconds), () => initWebSocket(retrySeconds * 2));
    }
    reconnectScheduled = true;
  }

  ws.onOpen.listen((e) {
    outputMsg('Connected');
    ws.send('Hello from Dart!');
  });...

That is nothing but the creation of new connections and work with it already. That is a separate thread (in fact, in which runs javaScript) connection is established and so on. Why then dart and JavaScript I can not in the same thread to open a simple UDP connection and work with him?

P.s.UDP is more preferred for online-browser-realtime-games.

Dima00782
  • 171
  • 1
  • 3
  • 13

1 Answers1

1

The browsers don't support it due to security constraints.
You should take a look at WebRTC

see also

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567