Anonchat.fromSocket constructor

Anonchat.fromSocket(
  1. Socket socket
)

Construct class from existing Socket

Implementation

Anonchat.fromSocket(this.socket)
    : onRawBytes = socket.asBroadcastStream(),
      onRawMap = socket.asBroadcastStream().map(
            (v) => jsonDecode(utf8.decode(v)),
          ),
      onMessage = socket.asBroadcastStream().map(
            (v) => Message.fromJson(jsonDecode(utf8.decode(v))),
          );