快速构建WebSocket客户端

1850次阅读  |  发布于5年以前

快速构建WebSocket客户端

Make a WebSocket connection using WebSocket.connect(), and send data over that connection using the WebSocket add() method.

import 'dart:io';

main() async {
  var socket = await WebSocket.connect('ws://127.0.0.1:4040/ws');
  socket.add('Hello, World!');
}

Copyright© 2013-2019

京ICP备2023019179号-2