public MeshNetwork CreateGroupChat(string networkName, string sharedSecret, bool localNetworkOnly) { //use random userId for each independent chat network for privacy reasons BinaryNumber randomUserId = SecureChannelStream.GenerateUserId(SecureChannelStream.GetPublicKeyFromPrivateKey(_privateKey)); MeshNetwork network = new MeshNetwork(_connectionManager, randomUserId, networkName, sharedSecret, localNetworkOnly); lock (_networks) { if (_networks.ContainsKey(network.NetworkId)) { network.Dispose(); throw new MeshException("Mesh network for group chat '" + network.NetworkName + "' already exists."); } _networks.Add(network.NetworkId, network); } return(network); }